]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MINOR: sendmail: The return of vsnprintf is not cleanly tested
authorThierry FOURNIER <thierry.fournier@ozon.io>
Thu, 9 Feb 2017 11:19:27 +0000 (12:19 +0100)
committerWilly Tarreau <w@1wt.eu>
Fri, 10 Feb 2017 05:18:17 +0000 (06:18 +0100)
The string formatted by vsnprintf may be bigger than the size of
the buffer "buf". This case is not tested.

This sould be backported to 1.6 and 1.7

src/checks.c

index 7d424226756537ab6313ff5004ed83a19b6fc059..49bd886bf3c2eaab3d51fb53d0240f17af6094e5 100644 (file)
@@ -3398,7 +3398,7 @@ void send_email_alert(struct server *s, int level, const char *format, ...)
        len = vsnprintf(buf, sizeof(buf), format, argp);
        va_end(argp);
 
-       if (len < 0) {
+       if (len < 0 || len >= sizeof(buf)) {
                Alert("Email alert [%s] could not format message\n", p->id);
                return;
        }