From: Michael R Sweet Date: Thu, 16 Sep 2021 15:47:36 +0000 (-0400) Subject: Fix indentation and add buffer range check. X-Git-Tag: v2.4b1~58 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ecc5afc75839eb73481a2ec41fbf7762c5ee7ea2;p=thirdparty%2Fcups.git Fix indentation and add buffer range check. --- diff --git a/cups/snprintf.c b/cups/snprintf.c index e4eb3e9757..d927f0ecd3 100644 --- a/cups/snprintf.c +++ b/cups/snprintf.c @@ -323,8 +323,8 @@ _cups_vsnprintf(char *buffer, /* O - Output buffer */ * Nul-terminate the string and return the number of characters needed. */ - if (bufptr) - *bufptr = '\0'; + if (bufptr && bufptr < bufend) + *bufptr = '\0'; return (bytes); }