Skip to content

Commit a5e5efe

Browse files
authored
tar: free two temporary allocated strings after use (libarchive#2255)
OSS-Fuzz issue: 70020
1 parent 09e7b6b commit a5e5efe

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

libarchive/archive_read_support_format_tar.c

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1349,9 +1349,12 @@ header_common(struct archive_read *a, struct tar *tar,
13491349
archive_strlen(&linkpath), tar->sconv) != 0) {
13501350
err = set_conversion_failed_error(a, tar->sconv,
13511351
"Linkname");
1352-
if (err == ARCHIVE_FATAL)
1352+
if (err == ARCHIVE_FATAL) {
1353+
archive_string_free(&linkpath);
13531354
return (err);
1355+
}
13541356
}
1357+
archive_string_free(&linkpath);
13551358
}
13561359
/*
13571360
* The following may seem odd, but: Technically, tar
@@ -1422,9 +1425,12 @@ header_common(struct archive_read *a, struct tar *tar,
14221425
archive_strlen(&linkpath), tar->sconv) != 0) {
14231426
err = set_conversion_failed_error(a, tar->sconv,
14241427
"Linkname");
1425-
if (err == ARCHIVE_FATAL)
1428+
if (err == ARCHIVE_FATAL) {
1429+
archive_string_free(&linkpath);
14261430
return (err);
1431+
}
14271432
}
1433+
archive_string_free(&linkpath);
14281434
}
14291435
archive_entry_set_filetype(entry, AE_IFLNK);
14301436
archive_entry_set_size(entry, 0);

0 commit comments

Comments
 (0)