Replace remaining sprintf() with snprintf() by myagmartseren · Pull Request #9476 · python-pillow/Pillow

and others added 2 commits

March 19, 2026 16:53
Replace unsafe sprintf() calls with bounds-checked snprintf() in:
- src/libImaging/QuantPngQuant.c (version string)
- src/libImaging/JpegEncode.c (version string)
- src/_webp.c (error messages and version string, 4 call sites)

This is consistent with the fix applied in CVE-2024-28219 which
addressed the same class of vulnerability in font rendering code.

Security: CWE-120 (Buffer Copy without Checking Size of Input)

@aclark4life aclark4life changed the title Replace remaining sprintf() with snprintf() (security) Replace remaining sprintf() with snprintf()

Mar 19, 2026