summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael R Sweet <michael.r.sweet@gmail.com>2021-08-30 16:10:15 -0400
committerGitHub <noreply@github.com>2021-08-30 16:10:15 -0400
commita75195039cda045f2500141dd23e336f138e4a5c (patch)
treea904766315faa24af2f1020c99386a78b2002bcb
parentd372f8b8d5a50bcebbdb9ca097bdc8beeb984cb4 (diff)
parent51998f16935742bb8bdc539a13d9f807965377e2 (diff)
downloadcups-a75195039cda045f2500141dd23e336f138e4a5c.tar.gz
Merge pull request #5949 from AtariDreams/null
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);
}