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