228318
diff --git a/fileio.c b/fileio.c
228318
index ba0a1d0..03fc4be 100644
228318
--- a/fileio.c
228318
+++ b/fileio.c
228318
@@ -2006,6 +2006,7 @@ int do_string(__G__ length, option)   /* return PK-type error code */
228318
     unsigned comment_bytes_left;
228318
     unsigned int block_len;
228318
     int error=PK_OK;
228318
+    unsigned int length2;
228318
 #ifdef AMIGA
228318
     char tmp_fnote[2 * AMIGA_FILENOTELEN];   /* extra room for squozen chars */
228318
 #endif
228318
@@ -2292,8 +2293,12 @@ int do_string(__G__ length, option)   /* return PK-type error code */
228318
             seek_zipf(__G__ G.cur_zipfile_bufstart - G.extra_bytes +
228318
                       (G.inptr-G.inbuf) + length);
228318
         } else {
228318
-            if (readbuf(__G__ (char *)G.extra_field, length) == 0)
228318
+            if ((length2 = readbuf(__G__ (char *)G.extra_field, length)) == 0)
228318
                 return PK_EOF;
228318
+            if(length2 < length) {
228318
+              memset (__G__ (char *)G.extra_field+length2, 0 , length-length2);
228318
+              length = length2;
228318
+            }
228318
             /* Looks like here is where extra fields are read */
228318
             getZip64Data(__G__ G.extra_field, length);
228318
 #ifdef UNICODE_SUPPORT