]> git.ipfire.org Git - thirdparty/cups.git/commitdiff
Prevent writing to NULL if buffer is NULL 5949/head
authorAlfonso Gregory <83477269+AtariDreams@users.noreply.github.com>
Mon, 30 Aug 2021 19:00:29 +0000 (15:00 -0400)
committerAlfonso Gregory <83477269+AtariDreams@users.noreply.github.com>
Mon, 30 Aug 2021 19:00:29 +0000 (15:00 -0400)
cups/snprintf.c

index 3c468571879251ac050316326464deb48ca69739..e4eb3e9757c96d4d1042e2947da52179bcdf2087 100644 (file)
@@ -1,6 +1,7 @@
 /*
  * snprintf functions for CUPS.
  *
+ * Copyright © 2021 by OpenPrinting
  * Copyright © 2007-2019 by Apple Inc.
  * Copyright © 1997-2007 by Easy Software Products.
  *
@@ -322,7 +323,8 @@ _cups_vsnprintf(char       *buffer, /* O - Output buffer */
   * Nul-terminate the string and return the number of characters needed.
   */
 
-  *bufptr = '\0';
+  if (bufptr)
+       *bufptr = '\0';
 
   return (bytes);
 }