From b198e9aa934386531b2bc1fd0291ed3cc6beaf96 Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Fri, 8 Oct 2021 19:34:20 +0200 Subject: tar: improve comments, add FIXMEs. no code changes Signed-off-by: Denys Vlasenko --- archival/libarchive/get_header_tar.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/archival/libarchive/get_header_tar.c b/archival/libarchive/get_header_tar.c index 2ab3c04..a142290 100644 --- a/archival/libarchive/get_header_tar.c +++ b/archival/libarchive/get_header_tar.c @@ -332,7 +332,6 @@ char FAST_FUNC get_header_tar(archive_handle_t *archive_handle) } /* Set bits 12-15 of the files mode */ - /* (typeflag was not trashed because chksum does not use getOctal) */ switch (tar_typeflag) { case '1': /* hardlink */ /* we mark hardlinks as regular files with zero size and a link name */ @@ -341,7 +340,7 @@ char FAST_FUNC get_header_tar(archive_handle_t *archive_handle) * ... For tar archives written by pre POSIX.1-1988 * implementations, the size field usually contains the size of * the file and needs to be ignored as no data may follow this - * header type. For POSIX.1- 1988 compliant archives, the size + * header type. For POSIX.1-1988 compliant archives, the size * field needs to be 0. For POSIX.1-2001 compliant archives, * the size field may be non zero, indicating that file data is * included in the archive. @@ -390,6 +389,7 @@ char FAST_FUNC get_header_tar(archive_handle_t *archive_handle) /* free: paranoia: tar with several consecutive longnames */ free(p_longname); /* For paranoia reasons we allocate extra NUL char */ +//FIXME: disallow huge sizes: p_longname = xzalloc(file_header->size + 1); /* We read ASCIZ string, including NUL */ xread(archive_handle->src_fd, p_longname, file_header->size); @@ -400,6 +400,7 @@ char FAST_FUNC get_header_tar(archive_handle_t *archive_handle) goto again; case 'K': free(p_linkname); +//FIXME: disallow huge sizes: p_linkname = xzalloc(file_header->size + 1); xread(archive_handle->src_fd, p_linkname, file_header->size); archive_handle->offset += file_header->size; -- cgit v1.1