Created
March 18, 2019 08:09
-
-
Save aktowns/91b307c87e142a2caa2f423e1ce69a81 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$OpenBSD: patch-src_log_c,v 1.8 2019/03/18 11:20:04 akt Exp $ | |
HAproxy: | |
Patch the log function to avoid vfprintf receiving a NULL value. | |
Index: src/log.c | |
--- src/log.c.orig | |
+++ src/log.c | |
@@ -984,11 +984,12 @@ | |
sep = host.len ? 1 : 0; | |
} | |
+ const char* month = monthname[tm.tm_mon]; | |
hdr_len = snprintf(logheader, global.max_syslog_len, | |
"<<<<>%s %2d %02d:%02d:%02d %.*s%*s", | |
- monthname[tm.tm_mon], | |
+ month == NULL ? "(null)" : month, | |
tm.tm_mday, tm.tm_hour, tm.tm_min, tm.tm_sec, | |
- host.len, host.str, sep, ""); | |
+ host.len, host.str == NULL ? "(null)" : host.str, sep, ""); | |
/* WARNING: depending upon implementations, snprintf may return | |
* either -1 or the number of bytes that would be needed to store | |
* the total message. In both cases, we must adjust it. | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment