Skip to content

Instantly share code, notes, and snippets.

@aktowns
Created March 18, 2019 08:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aktowns/91b307c87e142a2caa2f423e1ce69a81 to your computer and use it in GitHub Desktop.
Save aktowns/91b307c87e142a2caa2f423e1ce69a81 to your computer and use it in GitHub Desktop.
$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