BUG/MINOR: sendmail: The return of vsnprintf is not cleanly tested

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
This commit is contained in:
Thierry FOURNIER 2017-02-09 12:19:27 +01:00 committed by Willy Tarreau
parent cdade94cf5
commit 62c8a21c10

View 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;
}