Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix build failure with -Werror=format-security. #114

Merged
merged 1 commit into from
Apr 26, 2017

Conversation

sebastic
Copy link
Contributor

The Debian package build for NRPE 3.1.0 failed due to the hardening buildflags:

./utils.c: In function 'logit':
./utils.c:530:4: error: format not a string literal and no format arguments [-Werror=format-security]
    syslog(priority, buffer);
    ^~~~~~

As documented in syslog(3) the second argument should be a format string:

void syslog(int priority, const char *format, ...);
...
syslog() generates a log message, which will be distributed by syslogd(8). The priority argument is formed by ORing the facility and the level values (explained below). The remaining arguments are a format, as in printf(3) and any arguments required by the format, except that the two character sequence %m will be replaced by the error message string strerror(errno). A trailing newline may be added if needed.

@smooge
Copy link

smooge commented Apr 20, 2017

Thank you for putting this one in place. I was about to put in a PR for the same fix. Sorry for not catching it sooner.

@jfrickson jfrickson changed the base branch from master to maint April 26, 2017 14:23
@jfrickson jfrickson merged commit 50c4a43 into NagiosEnterprises:maint Apr 26, 2017
@jfrickson
Copy link
Contributor

Merged. Thanks!

@sebastic sebastic deleted the format-security branch April 26, 2017 14:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants