Commit 7be00c49 by Jeff Sturm Committed by Alexandre Petit-Bianco

zextract.c (read_zip_archive): Read file_offset before writing zipd and…

zextract.c (read_zip_archive): Read file_offset before writing zipd and consequently clobbering the header...

2000-01-24  Jeff Sturm  <jeff.sturm@commerceone.com>

	* zextract.c (read_zip_archive): Read file_offset before writing
	zipd and consequently clobbering the header contents.

(http://gcc.gnu.org/ml/gcc-patches/2001-01/msg02129.html)

From-SVN: r39328
parent f2d1f0ba
2000-01-24 Jeff Sturm <jeff.sturm@commerceone.com>
* zextract.c (read_zip_archive): Read file_offset before writing
zipd and consequently clobbering the header contents.
2001-01-27 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
* Make-lang.in: Remove all dependencies on defaults.h.
......
......@@ -323,6 +323,7 @@ read_zip_archive (zipf)
long uncompressed_size = makelong (&dir_ptr[4+C_UNCOMPRESSED_SIZE]);
long filename_length = makeword (&dir_ptr[4+C_FILENAME_LENGTH]);
long extra_field_length = makeword (&dir_ptr[4+C_EXTRA_FIELD_LENGTH]);
long file_offset = makelong (&dir_ptr[4+C_RELATIVE_OFFSET_LOCAL_HEADER]);
int unpadded_direntry_length;
if ((dir_ptr-zipf->central_directory)+filename_length+CREC_SIZE+4>zipf->dir_size)
return -1;
......@@ -337,8 +338,7 @@ read_zip_archive (zipf)
#else
#define DIR_ALIGN sizeof(long)
#endif
zipd->filestart = find_zip_file_start (zipf->fd,
makelong (&dir_ptr[4+C_RELATIVE_OFFSET_LOCAL_HEADER]));
zipd->filestart = find_zip_file_start (zipf->fd, file_offset);
zipd->filename_offset = CREC_SIZE+4 - dir_last_pad;
unpadded_direntry_length
= zipd->filename_offset + zipd->filename_length + extra_field_length;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment