SHA256
1
0
forked from pool/busybox
busybox/busybox.libunarchive-array.patch

40 lines
1.6 KiB
Diff

archival/libunarchive/get_header_tar.c: In function 'get_header_tar':
archival/libunarchive/get_header_tar.c:140: warning: array subscript is above array bounds
archival/libunarchive/get_header_tar.c:155: warning: array subscript is above array bounds
archival/libunarchive/get_header_tar.c:158: warning: array subscript is above array bounds
make[1]: *** [archival/libunarchive/get_header_tar.o] Error 1
---
archival/libunarchive/get_header_tar.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
--- a/archival/libunarchive/get_header_tar.c
+++ b/archival/libunarchive/get_header_tar.c
@@ -162,8 +162,8 @@ char get_header_tar(archive_handle_t *ar
}
file_header->link_target = NULL;
if (!linkname && parse_names && tar.linkname[0]) {
- /* we trash magic[0] here, it's ok */
- tar.linkname[sizeof(tar.linkname)] = '\0';
+ /* we trash magic[0] here to terminate tar.linkname, it's ok */
+ tar.magic[0] = '\0';
file_header->link_target = xstrdup(tar.linkname);
/* FIXME: what if we have non-link object with link_target? */
/* Will link_target be free()ed? */
@@ -177,11 +177,11 @@ char get_header_tar(archive_handle_t *ar
file_header->name = NULL;
if (!longname && parse_names) {
- /* we trash mode[0] here, it's ok */
- tar.name[sizeof(tar.name)] = '\0';
+ /* we trash mode[0] here to terminate tar.name, it's ok */
+ tar.mode[0] = '\0';
if (tar.prefix[0]) {
- /* and padding[0] */
- tar.prefix[sizeof(tar.prefix)] = '\0';
+ /* and padding[0] to terminate tar.prefix */
+ tar.padding[0] = '\0';
file_header->name = concat_path_file(tar.prefix, tar.name);
} else
file_header->name = xstrdup(tar.name);