home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #26 / NN_1992_26.iso / spool / gnu / utils / bug / 2029 < prev    next >
Encoding:
Text File  |  1992-11-10  |  1.4 KB  |  41 lines

  1. Newsgroups: gnu.utils.bug
  2. Path: sparky!uunet!think.com!sdd.hp.com!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!cc.uow.EDU.AU!amorton
  3. From: amorton@cc.uow.EDU.AU (andrew morton)
  4. Subject: Bug in tar-1.11?
  5. Message-ID: <199211102308.AA13985@wampyr.cc.uow.edu.au>
  6. Sender: gnulists@ai.mit.edu
  7. Organization: GNUs Not Usenet
  8. Distribution: gnu
  9. Date: Wed, 11 Nov 1992 15:08:52 GMT
  10. Approved: bug-gnu-utils@prep.ai.mit.edu
  11. Lines: 28
  12.  
  13. In tar-1.11, extract.c, line 343 or thereabouts, we have
  14.  
  15.  
  16.              /*
  17.               * Kludge alert.  NAME is assigned to header.name
  18.               * because during the extraction, the space that
  19.               * contains the header will get scribbled on, and
  20.               * the name will get munged, so any error messages
  21.               * that happen to contain the filename will look
  22.               * REAL interesting unless we do this.
  23.               */
  24.              namelen = strlen(skipcrud + current_file_name);
  25.              name = (char *) malloc((sizeof(char)) * namelen);
  26.              bcopy(skipcrud+current_file_name, name, namelen);
  27.              size = hstat.st_size;
  28.              extract_sparse_file(fd, &size, hstat.st_size, name);
  29.  
  30. Is it not the case that 'name' is not null-terminated?
  31. Don't we want:
  32.  
  33.              namelen = strlen(skipcrud + current_file_name);
  34.              name = (char *) malloc((sizeof(char)) * (namelen + 1));
  35.              bcopy(skipcrud+current_file_name, name, namelen);
  36.             name[namelen] = '\0';
  37.              size = hstat.st_size;
  38.              extract_sparse_file(fd, &size, hstat.st_size, name);
  39.  
  40.  
  41.