Commit 89a9974e4 for imagemagick.org
commit 89a9974e40136a1ecf36b168d9420e0b551d6f97
Author: OrbisAI Security <mediratta01.pally@gmail.com>
Date: Mon Jun 15 18:19:22 2026 +0530
chore: remove legacy vsprintf fallback in drawing-wand.c (#8796)
vsnprintf has been universally available since C99 (1999) and is
detected at build time via MAGICKCORE_HAVE_VSNPRINTF. The #else vsprintf
branches in MVGPrintf and MVGAutoWrapPrintf are dead code on all
supported platforms. Remove them to simplify the code and eliminate the
unsafe function from the source, even as unreachable paths.
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-authored-by: Cristy <12486802+urban-warrior@users.noreply.github.com>
diff --git a/MagickWand/drawing-wand.c b/MagickWand/drawing-wand.c
index a94659a5e..e89a1cccc 100644
--- a/MagickWand/drawing-wand.c
+++ b/MagickWand/drawing-wand.c
@@ -225,11 +225,7 @@ static int MVGPrintf(DrawingWand *wand,const char *format,...)
if (offset > 0)
{
va_start(argp,format);
-#if defined(MAGICKCORE_HAVE_VSNPRINTF)
count=vsnprintf(wand->mvg+wand->mvg_length,(size_t) offset,format,argp);
-#else
- count=vsprintf(wand->mvg+wand->mvg_length,format,argp);
-#endif
va_end(argp);
}
if ((count < 0) || (count > (int) offset))
@@ -259,11 +255,7 @@ static int MVGAutoWrapPrintf(DrawingWand *wand,const char *format,...)
argp;
va_start(argp,format);
-#if defined(MAGICKCORE_HAVE_VSNPRINTF)
count=vsnprintf(buffer,sizeof(buffer)-1,format,argp);
-#else
- count=vsprintf(buffer,format,argp);
-#endif
va_end(argp);
buffer[sizeof(buffer)-1]='\0';
if (count < 0)