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