Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
SUSE:SLE-12-SP4:GA
pacemaker.14737
pacemaker-crm_mon-non-standard-failing-asctime....
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File pacemaker-crm_mon-non-standard-failing-asctime.patch of Package pacemaker.14737
commit a7476dd96e79197f65acf0f049f75ce8e8f9e801 Author: Jan Pokorny <jpokorny@redhat.com> Date: Thu Feb 2 14:51:46 2017 +0100 Fix: crm_mon: protect against non-standard or failing asctime So far, we have been likely covered by standards requiring asctime to produce an output ending with \n\0 bytes, because otherwise, we would overrun the buffer, reading unspecified content, possibly segfaulting. This was actually discovered with a brand new GCC7 warning ( [-Werror=pointer-compare]). Another latent issue was that the code was not ready for the case of failing asctime call (returning NULL). This is now fixed as well. diff --git a/tools/crm_mon.c b/tools/crm_mon.c index 776aea8b3..023b07b11 100644 --- a/tools/crm_mon.c +++ b/tools/crm_mon.c @@ -954,10 +954,10 @@ print_nvpair(FILE *stream, const char *name, const char *value, /* Otherwise print user-friendly time string */ } else { - char *date_str, *c; + static char empty_str[] = ""; + char *c, *date_str = asctime(localtime(&epoch_time)); - date_str = asctime(localtime(&epoch_time)); - for (c = date_str; c != '\0'; ++c) { + for (c = (date_str != NULL) ? date_str : empty_str; *c != '\0'; ++c) { if (*c == '\n') { *c = '\0'; break;
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor