From 3878a9bbf79791463bf6acac2a51486b60dfd409 Mon Sep 17 00:00:00 2001 From: Alfonso Gregory <83477269+AtariDreams@users.noreply.github.com> Date: Mon, 30 Aug 2021 14:07:05 -0400 Subject: [PATCH] Prevent writing to NULL if buffer is NULL --- cups/snprintf.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cups/snprintf.c b/cups/snprintf.c index ff680321a0..e4eb3e9757 100644 --- a/cups/snprintf.c +++ b/cups/snprintf.c @@ -323,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); } -- 2.47.2