* Jakub Wilk , 2018-01-04, 21:01:
$ export TAR_OPTIONS='--owner root --group root --mode go-r'
$ tar -cvvf foo.tar /dev/null
tar: Removing leading `/' from member names
crw--w--w- `/dev/null 1,3 2018-01-04 18:42 /dev/null
Valgrind suggests it's a use-after-free:
Invalid read of size 1
at 0x48323D8: strlen (in
/usr/lib/valgrind/vgpreload_memcheck-x86-linux.so)
by 0x14DBD9: xstrdup (xmalloc.c:121)
by 0x116616: start_header (create.c:944)
by 0x118070: dump_file0 (create.c:1951)
by 0x118070: dump_file (create.c:1981)
by 0x118C43: create_archive (create.c:1438)
by 0x10E2DA: main (tar.c:2752)
Address 0x4b07280 is 0 bytes inside a block of size 5 free'd
at 0x4830478: free (in /usr/lib/valgrind/vgpreload_memcheck-x86-linux.so)
by 0x13A222: wordsplit_free_words (wordsplit.c:1551)
by 0x13A2D9: wordsplit_free (wordsplit.c:1561)
by 0x10D6AB: parse_default_options (tar.c:2226)
by 0x10D6AB: decode_options (tar.c:2331)
by 0x10D6AB: main (tar.c:2726)
Block was alloc'd at
at 0x482F2BC: malloc (in
/usr/lib/valgrind/vgpreload_memcheck-x86-linux.so)
by 0x13AA45: wordsplit_finish (wordsplit.c:557)
by 0x13AA45: wordsplit_len (wordsplit.c:1529)
by 0x13AC22: wordsplit (wordsplit.c:1537)
by 0x10D68C: parse_default_options (tar.c:2217)
by 0x10D68C: decode_options (tar.c:2331)
by 0x10D68C: main (tar.c:2726)
--
Jakub Wilk