e773f2
diff --git a/src/libImaging/Convert.c b/src/libImaging/Convert.c
e773f2
index b3e48e5..cfed8ad 100644
e773f2
--- a/src/libImaging/Convert.c
e773f2
+++ b/src/libImaging/Convert.c
e773f2
@@ -1338,9 +1338,8 @@ convert(Imaging imOut, Imaging imIn, const char *mode,
e773f2
         return (Imaging) ImagingError_ValueError("conversion not supported");
e773f2
 #else
e773f2
     {
e773f2
-      static char buf[256];
e773f2
-      /* FIXME: may overflow if mode is too large */
e773f2
-      sprintf(buf, "conversion from %s to %s not supported", imIn->mode, mode);
e773f2
+      static char buf[100];
e773f2
+      snprintf(buf, 100, "conversion from %.10s to %.10s not supported", imIn->mode, mode);
e773f2
       return (Imaging) ImagingError_ValueError(buf);
e773f2
     }
e773f2
 #endif
e773f2
@@ -1394,9 +1393,13 @@ ImagingConvertTransparent(Imaging imIn, const char *mode,
e773f2
     }
e773f2
 #else
e773f2
     {
e773f2
-      static char buf[256];
e773f2
-      /* FIXME: may overflow if mode is too large */
e773f2
-      sprintf(buf, "conversion from %s to %s not supported in convert_transparent", imIn->mode, mode);
e773f2
+      static char buf[100];
e773f2
+      snprintf(
e773f2
+        buf,
e773f2
+        100,
e773f2
+        "conversion from %.10s to %.10s not supported in convert_transparent",
e773f2
+        imIn->mode,
e773f2
+        mode);
e773f2
       return (Imaging) ImagingError_ValueError(buf);
e773f2
     }
e773f2
 #endif