Skip to content

Commit e0d803e

Browse files
committed
(tar_short_read): fix undefined behaviour.
Use (char *) record_start, instead of record_start->buffer, to avoid undefined behavior accessing past end of buffer. In practice the undefined behavior is harmless unless running with -fsanitize=undefined or a similarly-picky implementation. Sync with GNU tar 7d96e820a52531097db23f38725e178a9f7d66b0. Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
1 parent fafce61 commit e0d803e

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/vfs/tar/tar-internal.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,8 +85,8 @@ tar_short_read (size_t status, tar_super_t *archive)
8585
size_t left; // bytes left
8686
char *more; // pointer to next byte to read
8787

88-
more = archive->record_start->buffer + status;
8988
left = record_size - status;
89+
more = (char *) archive->record_start + status;
9090

9191
while (left % BLOCKSIZE != 0 || (left != 0 && status != 0))
9292
{

0 commit comments

Comments
 (0)