From 8bef0925e831b8b5092b6282cb5d8b68dad62cc0 Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Fri, 24 Jan 2003 02:37:34 +0000 Subject: [PATCH] jcf-parse.c (parse_zip_file_entries): Overwrite trailing \0 of file name in resource buffer. * jcf-parse.c (parse_zip_file_entries): Overwrite trailing \0 of file name in resource buffer. From-SVN: r61694 --- gcc/java/ChangeLog | 5 +++++ gcc/java/jcf-parse.c | 4 +++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/gcc/java/ChangeLog b/gcc/java/ChangeLog index 3050610a291..0d084b42224 100644 --- a/gcc/java/ChangeLog +++ b/gcc/java/ChangeLog @@ -1,3 +1,8 @@ +2003-01-23 Tom Tromey + + * jcf-parse.c (parse_zip_file_entries): Overwrite trailing \0 of + file name in resource buffer. + 2003-01-23 Tom Tromey * expr.c (build_known_method_ref): Use method's context to find diff --git a/gcc/java/jcf-parse.c b/gcc/java/jcf-parse.c index 7545aa18efa..2f03202d5dd 100644 --- a/gcc/java/jcf-parse.c +++ b/gcc/java/jcf-parse.c @@ -1221,7 +1221,9 @@ parse_zip_file_entries (void) buffer = ALLOC (zdir->filename_length + 1 + (jcf->buffer_end - jcf->buffer)); strcpy (buffer, file_name); - memcpy (buffer + zdir->filename_length + 1, + /* This is not a typo: we overwrite the trailing \0 of the + file name; this is just how the data is laid out. */ + memcpy (buffer + zdir->filename_length, jcf->buffer, jcf->buffer_end - jcf->buffer); compile_resource_data (file_name, buffer, -- 2.30.2