NULL pointer passed to fprintf
bill-auger opened this issue · comments
this causes the build to fail with -Werror
find-cursor.c: In function ‘draw’:
find-cursor.c:152:3: warning: ‘%s’ directive argument is null [-Wformat-overflow=]
152 | fprintf(stderr, "%s: cannot connect to X server %s\n", name, display_name);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
'display_name' will always be NULL on line 152 - this is the correction:
if (!display_name) {
fprintf(stderr, "%s: cannot connect to X server\n", name);
Also reported on pull request #11
Markus
ok i didnt check for open PRs - it looks like the maintainer was
hoping that you would squash a new commit changing the error
message like before merging it:
ERROR: $DISPLAY is not set in the environment
Thanks @maramon and @bill-auger; I commented on that PR and after that I just, well, forgot :-/
I changed the error message and merged. Thanks both!