Przeglądaj źródła

always allocate data for pkg->file->size so we don't overwrite other data

Wichert Akkerman 24 lat temu
rodzic
commit
d49e73a5bd
1 zmienionych plików z 2 dodań i 1 usunięć
  1. 2 1
      main/processarc.c

+ 2 - 1
main/processarc.c

@@ -196,8 +196,9 @@ void process_archive(const char *filename) {
     pkg->files= nfmalloc(sizeof(struct filedetails));
     pkg->files->next= 0;
     pkg->files->name= pkg->files->msdosname= pkg->files->md5sum= 0;
-    pkg->files->size= nfmalloc(30);
   }
+  /* Always nfmalloc.  Otherwise, we may overwrite some other field. */
+  pkg->files->size= nfmalloc(30);
   sprintf(pkg->files->size,"%lu",(unsigned long)stab.st_size);
 
   if (cipaction->arg == act_avail) {