summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlfonso Gregory <83477269+AtariDreams@users.noreply.github.com>2021-08-30 15:00:29 -0400
committerAlfonso Gregory <83477269+AtariDreams@users.noreply.github.com>2021-08-30 15:00:29 -0400
commit51998f16935742bb8bdc539a13d9f807965377e2 (patch)
treed418ef2d57d02555c1f6ff2aa63a3dcfd61d2991
parent67654f6346ec8b510cc7889a19409983dbfc6b7d (diff)
downloadcups-51998f16935742bb8bdc539a13d9f807965377e2.tar.gz
Prevent writing to NULL if buffer is NULL
-rw-r--r--cups/snprintf.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/cups/snprintf.c b/cups/snprintf.c
index 3c4685718..e4eb3e975 100644
--- a/cups/snprintf.c
+++ b/cups/snprintf.c
@@ -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);
}