https://github.com/ImageMagick/ImageMagick/issues/293
diff --git a/coders/xpm.c b/coders/xpm.c
index 7d9021c..088303d 100644
--- a/coders/xpm.c
+++ b/coders/xpm.c
@@ -336,7 +336,7 @@
     if (count == 4)
       break;
   }
-  if ((count != 4) || (width == 0) || (width > 2) ||
+  if ((count != 4) || (width == 0) || (width > 3) ||
       (image->columns == 0) || (image->rows == 0) ||
       (image->colors == 0) || (image->colors > MaxColormapSize))
     {