Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use snprintf instead of sprintf #5567

Merged
merged 2 commits into from Jul 1, 2021
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 4 additions & 6 deletions src/libImaging/Convert.c
Expand Up @@ -1594,9 +1594,8 @@ convert(
#ifdef notdef
return (Imaging)ImagingError_ValueError("conversion not supported");
#else
static char buf[256];
/* FIXME: may overflow if mode is too large */
sprintf(buf, "conversion from %s to %s not supported", imIn->mode, mode);
static char buf[100];
sprintf(buf, "conversion from %.10s to %.10s not supported", imIn->mode, mode);
return (Imaging)ImagingError_ValueError(buf);
#endif
}
Expand Down Expand Up @@ -1645,11 +1644,10 @@ ImagingConvertTransparent(Imaging imIn, const char *mode, int r, int g, int b) {
}
#else
{
static char buf[256];
/* FIXME: may overflow if mode is too large */
static char buf[100];
sprintf(
buf,
"conversion from %s to %s not supported in convert_transparent",
"conversion from %.10s to %.10s not supported in convert_transparent",
imIn->mode,
mode);
return (Imaging)ImagingError_ValueError(buf);
Expand Down