summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cups/snprintf.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/cups/snprintf.c b/cups/snprintf.c
index e4eb3e975..066252ee7 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);
}