f6883d
diff --git a/list.c b/list.c
f6883d
index f7359c3..4c3d703 100644
f6883d
--- a/list.c
f6883d
+++ b/list.c
f6883d
@@ -97,7 +97,7 @@ int list_files(__G)    /* return PK-type error code */
f6883d
 {
f6883d
     int do_this_file=FALSE, cfactor, error, error_in_archive=PK_COOL;
f6883d
 #ifndef WINDLL
f6883d
-    char sgn, cfactorstr[10];
f6883d
+    char sgn, cfactorstr[13];
f6883d
     int longhdr=(uO.vflag>1);
f6883d
 #endif
f6883d
     int date_format;
f6883d
@@ -339,7 +339,19 @@ int list_files(__G)    /* return PK-type error code */
f6883d
                 G.crec.compression_method == ENHDEFLATED) {
f6883d
                 methbuf[5] = dtype[(G.crec.general_purpose_bit_flag>>1) & 3];
f6883d
             } else if (methnum >= NUM_METHODS) {
f6883d
-                sprintf(&methbuf[4], "%03u", G.crec.compression_method);
f6883d
+                /* 2013-02-26 SMS.
f6883d
+                 * http://sourceforge.net/tracker/?func=detail
f6883d
+                 *  &aid=2861648&group_id=118012&atid=679786
f6883d
+                 * Unexpectedly large compression methods overflow
f6883d
+                 * &methbuf[].  Use the old, three-digit decimal format
f6883d
+                 * for values which fit.  Otherwise, sacrifice the
f6883d
+                 * colon, and use four-digit hexadecimal.
f6883d
+                 */
f6883d
+                if (G.crec.compression_method <= 999) {
f6883d
+                    sprintf( &methbuf[ 4], "%03u", G.crec.compression_method);
f6883d
+                } else {
f6883d
+                    sprintf( &methbuf[ 3], "%04X", G.crec.compression_method);
f6883d
+                }
f6883d
             }
f6883d
 
f6883d
 #if 0       /* GRR/Euro:  add this? */