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