* src/arscan.c (ar_member_touch): [SV 54533] Stop \0 in archive headers

This commit is contained in:
Paul Smith 2018-09-16 01:09:10 -04:00
parent 5d6508a475
commit 214865ed5c

View File

@ -904,14 +904,12 @@ ar_member_touch (const char *arname, const char *memname)
EINTRLOOP (r, fstat (fd, &statbuf)); EINTRLOOP (r, fstat (fd, &statbuf));
if (r < 0) if (r < 0)
goto lose; goto lose;
#if defined(ARFMAG) || defined(ARFZMAG) || defined(AIAMAG) || defined(WINDOWS32)
/* Advance member's time to that time */ /* Advance member's time to that time */
#if defined(ARFMAG) || defined(ARFZMAG) || defined(AIAMAG) || defined(WINDOWS32)
for (ui = 0; ui < sizeof ar_hdr.ar_date; ui++) for (ui = 0; ui < sizeof ar_hdr.ar_date; ui++)
ar_hdr.ar_date[ui] = ' '; ar_hdr.ar_date[ui] = ' ';
sprintf (TOCHAR (ar_hdr.ar_date), "%lu", (long unsigned) statbuf.st_mtime); sprintf (TOCHAR (ar_hdr.ar_date), "%lu", (long unsigned) statbuf.st_mtime);
#ifdef AIAMAG
ar_hdr.ar_date[strlen (ar_hdr.ar_date)] = ' '; ar_hdr.ar_date[strlen (ar_hdr.ar_date)] = ' ';
#endif
#else #else
ar_hdr.ar_date = statbuf.st_mtime; ar_hdr.ar_date = statbuf.st_mtime;
#endif #endif