Following code generate a _dubious_ warning message:

int main(void) {
    const char * const literal = "xxx";

    fprintf(stderr, literal);

    return 0;
}

cc -Wall -Wformat-security -o main main.c
main.c: In function `main':
main.c:9: warning: format not a string literal and no format arguments


check_format_info() in gcc/c-format.c doesn't check if the format
argument is a _pointer_ to a string literal.
 
 
best regards
 
HGN

Reply via email to