Skip to content

warning NULL argument for printf %s would benefit from explanation #96

@andrew-taylor

Description

@andrew-taylor
$ cat /tmp/a.c
#include <stdio.h>

int main(void) {
	char *p = NULL;
	printf("%s", p);
}
$ dcc a.c
a.c: In function ‘main’:
a.c:5:17: warning: ‘%s’ directive argument is null [-Wformat-overflow=]
    5 |         printf("%s", p);
      |                 ^~

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions