I *think* this debian commit could possibly be a good candidate to fix Artful FTBFS situation.
-------
$ git show a7476dd9
commit a7476dd96e79197f65acf0f049f75ce8e8f9e801
Author: Jan Pokorny <email address hidden>
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.
I *think* this debian commit could possibly be a good candidate to fix Artful FTBFS situation.
------- f65acf0f049f75c e8e8f9e801
$ git show a7476dd9
commit a7476dd96e79197
Author: Jan Pokorny <email address hidden>
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 pointer- compare] ).
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=
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 776aea8..023b07b 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 */ localtime( &epoch_ time));
} else {
- char *date_str, *c;
+ static char empty_str[] = "";
+ char *c, *date_str = asctime(
- date_str = asctime( localtime( &epoch_ time));
break;
- for (c = date_str; c != '\0'; ++c) {
+ for (c = (date_str != NULL) ? date_str : empty_str; *c != '\0'; ++c) {
if (*c == '\n') {
*c = '\0';
-------
I'll give it a try and update the case with the outcome of my test.
- Eric