From 51998f16935742bb8bdc539a13d9f807965377e2 Mon Sep 17 00:00:00 2001 From: Alfonso Gregory <83477269+AtariDreams@users.noreply.github.com> Date: Mon, 30 Aug 2021 15:00:29 -0400 Subject: Prevent writing to NULL if buffer is NULL --- cups/snprintf.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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); } -- cgit v1.2.1