From 092c373ee72162836519f2232f19b136823dad8b Mon Sep 17 00:00:00 2001 From: Rose <83477269+AtariDreams@users.noreply.github.com> Date: Fri, 1 Oct 2021 10:41:58 -0400 Subject: Add buffer range check. --- cups/snprintf.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'cups') 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); } -- cgit v1.2.1