When handling with copy/move commands inside of archive we can lead into buffer overflow
steps to roproduce:
create simple 7z archive
open it
rename single filename
hit buffer overflow
found by clang/AddressSanitizer
==17794==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x602000273593 at pc 0x00000045f2a9 bp 0x7ffc94aa8e20 sp 0x7ffc94aa85d0
READ of size 2 at 0x602000273593 thread T0
#0 0x45f2a8 in __interceptor_strchr.part.44 (/usr/bin/mc+0x45f2a8)
#1 0x70fb72 in extfs_find_entry_int /tmp/portage/app-misc/mc-9999/work/mc-9999/src/vfs/extfs/extfs.c:312:13
#2 0x70f562 in extfs_find_entry /tmp/portage/app-misc/mc-9999/work/mc-9999/src/vfs/extfs/extfs.c:331:11
#3 0x712131 in extfs_internal_stat /tmp/portage/app-misc/mc-9999/work/mc-9999/src/vfs/extfs/extfs.c:1117:13
#4 0x7f3de308ab59 in mc_stat /tmp/portage/app-misc/mc-9999/work/mc-9999/lib/vfs/interface.c:556:46
#5 0x538575 in file_mask_dialog /tmp/portage/app-misc/mc-9999/work/mc-9999/src/filemanager/filegui.c:1340:25
#6 0x6e0753 in panel_operate /tmp/portage/app-misc/mc-9999/work/mc-9999/src/filemanager/file.c:2718:13
#7 0x6bdabd in rename_cmd /tmp/portage/app-misc/mc-9999/work/mc-9999/src/filemanager/cmd.c:811:9
#8 0x551ef4 in midnight_execute_cmd /tmp/portage/app-misc/mc-9999/work/mc-9999/src/filemanager/midnight.c:1307:9
#9 0x7f3de30a49e7 in buttonbar_callback /tmp/portage/app-misc/mc-9999/work/mc-9999/lib/widget/buttonbar.c:172:42
#10 0x7f3de30b2305 in dlg_try_hotkey /tmp/portage/app-misc/mc-9999/work/mc-9999/lib/widget/dialog.c:464:23
#11 0x7f3de30b199a in dlg_key_event /tmp/portage/app-misc/mc-9999/work/mc-9999/lib/widget/dialog.c:509:19
#12 0x7f3de30b2ef9 in frontend_dlg_run /tmp/portage/app-misc/mc-9999/work/mc-9999/lib/widget/dialog.c:570:9
#13 0x7f3de30b2af5 in dlg_run /tmp/portage/app-misc/mc-9999/work/mc-9999/lib/widget/dialog.c:1267:5
#14 0x5507bb in do_nc /tmp/portage/app-misc/mc-9999/work/mc-9999/src/filemanager/midnight.c:1827:9
#15 0x50b874 in main /tmp/portage/app-misc/mc-9999/work/mc-9999/src/main.c:403:21
#16 0x7f3de1ec78fb in __libc_start_main (/lib64/libc.so.6+0x208fb)
#17 0x427f48 in _start (/usr/bin/mc+0x427f48)
Signed-off-by: Andreas Mohr <and@gmx.li>
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
* 3606_shell_segfault:
(mc_shell_recognize_path): clarify duplicate comments
Ticket #3606: fix segfault due to incorrect value of SHELL environment variable.
* 3566_msg_notify:
Clarify send of MSG_NOTIFY.
Split MSG_ACTION into MSG_ACTION and MSG_NOTIFY.
Ticket #3566: Split MSG_ACTION into MSG_ACTION and MSG_NOTIFY.
Start step: simplify buttonbar and menu handling.
We make WButtonBar send the command directly to the target widget. This
lets us simplify the MSG_ACTION case in dialog handlers. The menu handling
too is simplified here.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
`$*` must be quoted unless it's a command
`%*` must not quoted (already quoted)
1) quoting fixes
2) indentation fixes
3) `while` replaced by `for` loops
4) header comment (taken from source code)
Signed-off-by: Andreas Mohr <and@gmx.li>
Signed-off-by: Yury V. Zaytsev <yury@shurup.com>
* 3547_cleanup: (61 commits)
Update po/mc.pot.
Remove unneeded `struct` keyword for typedef'd structs
src/editor/edit.c: Cleanup some compiler warnings
src/editor/editbuffer.c: Cleanup some compiler warning
src/editor/editwidget.c: Cleanup some compiler warnings
(etags_set_definition_hash): refactoring:
Add -Wassign-enum compiler wirning.
(widget_options_t): add W_DEFAULT value to cleanup -Wassign-enum warnings.
Add three new compiler warnings:
Cleanup -Wfloat-conversion warning.
(edit_block_copy_cmd): cleanup -Wconditional-uninitialized warning.
(edit_search_fix_search_start_if_selection): cleanup -Wlogical-not-parentheses warning.
(mc_error_message): make output format translatable.
Find File: clarify description of exit from panelize mode.
WPanel should report MSG_NOT_HANDLED for unhandled commands.
Sync with gnulib 781788eeb5d4d0b816698e8629300cd90a7379bd.
lib/widget/input.c: (quote): change type to gboolean.
(tree_chdir, sync_tree): take vfs_path_t object to avoid double conversion of path.
(set_display_type): ret rid of string reduplication.
(expand_format): ret rid of extra string duplication.
...
mountlist: recognize autofs-mounted remote file systems, too.
src/filemanager/mountlist.c (ME_REMOTE): Return true if a file system
i named "-hosts" because it is used by autofs to mount remote file
systems.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>