mc/src
Andreas Mohr 924a84a3b4 sftpfs: fix bad pointer arithmetic in config parser.
When reading ssh_config with matching host entry mc do bad pointer arithmetic.
Fix it! (Also move offsetof values into struct to reduce human mistakes.)

==18689==ERROR: AddressSanitizer: heap-use-after-free on address 0x604000004910 at pc 0x000000641a8b bp 0x7ffca4ab65e0 sp 0x7ffca4ab65d8
WRITE of size 8 at 0x604000004910 thread T0
    #0 0x641a8a in sftpfs_fill_config_entity_from_string /tmp/portage/app-misc/mc-9999/work/mc-9999/src/vfs/sftpfs/config_parser.c:169:30
    #1 0x6413cf in sftpfs_fill_config_entity_from_config /tmp/portage/app-misc/mc-9999/work/mc-9999/src/vfs/sftpfs/config_parser.c:271:13
    #2 0x640b73 in sftpfs_get_config_entity /tmp/portage/app-misc/mc-9999/work/mc-9999/src/vfs/sftpfs/config_parser.c:310:14
    #3 0x64067d in sftpfs_fill_connection_data_from_config /tmp/portage/app-misc/mc-9999/work/mc-9999/src/vfs/sftpfs/config_parser.c:354:21
    #4 0x61ef95 in sftpfs_cb_open_connection /tmp/portage/app-misc/mc-9999/work/mc-9999/src/vfs/sftpfs/vfs_subclass.c:111:5
    #5 0x7f1340c31beb in vfs_s_get_path /tmp/portage/app-misc/mc-9999/work/mc-9999/lib/vfs/direntry.c:1139:18
    #6 0x7f1340c3685c in vfs_s_inode_from_path /tmp/portage/app-misc/mc-9999/work/mc-9999/lib/vfs/direntry.c:380:9
    #7 0x7f1340c34807 in vfs_s_opendir /tmp/portage/app-misc/mc-9999/work/mc-9999/lib/vfs/direntry.c:409:11
    #8 0x7f1340c34ce8 in vfs_s_chdir /tmp/portage/app-misc/mc-9999/work/mc-9999/lib/vfs/direntry.c:476:12
    #9 0x7f1340c3a29f in mc_chdir /tmp/portage/app-misc/mc-9999/work/mc-9999/lib/vfs/interface.c:687:14
    #10 0x530f64 in _do_panel_cd /tmp/portage/app-misc/mc-9999/work/mc-9999/src/filemanager/panel.c:3250:9
    #11 0x530e4e in do_panel_cd /tmp/portage/app-misc/mc-9999/work/mc-9999/src/filemanager/panel.c:4627:9
    #12 0x532d34 in do_cd /tmp/portage/app-misc/mc-9999/work/mc-9999/src/filemanager/panel.c:5027:11
    #13 0x50b64b in do_cd_command /tmp/portage/app-misc/mc-9999/work/mc-9999/src/filemanager/command.c:445:14
    #14 0x50c516 in enter /tmp/portage/app-misc/mc-9999/work/mc-9999/src/filemanager/command.c:265:9
    #15 0x52704c in midnight_callback /tmp/portage/app-misc/mc-9999/work/mc-9999/src/filemanager/midnight.c:1473:17
    #16 0x7f1340c4c761 in dlg_key_event /tmp/portage/app-misc/mc-9999/work/mc-9999/lib/widget/dialog.c:505:15
    #17 0x7f1340c4cc32 in frontend_dlg_run /tmp/portage/app-misc/mc-9999/work/mc-9999/lib/widget/dialog.c:570:9
    #18 0x7f1340c4c935 in dlg_run /tmp/portage/app-misc/mc-9999/work/mc-9999/lib/widget/dialog.c:1267:5
    #19 0x52654d in do_nc /tmp/portage/app-misc/mc-9999/work/mc-9999/src/filemanager/midnight.c:1757:9
    #20 0x4f7d8a in main /tmp/portage/app-misc/mc-9999/work/mc-9999/src/main.c:401:21
    #21 0x7f133f1b8953 in __libc_start_main (/lib64/libc.so.6+0x20953)
    #22 0x427368 in _start (/tmp/portage/app-misc/mc-9999/work/mc-9999/src/.libs/mc+0x427368)

Signed-off-by: Andreas Mohr <and@gmx.li>
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
2016-02-13 16:38:40 +03:00
..
consaver Update copyright years. 2016-01-01 11:48:10 +03:00
diffviewer Update copyright years. 2016-01-01 11:48:10 +03:00
editor Ticket #2673: support LZIP compression. 2016-01-28 16:45:36 +03:00
filemanager Use meaningful errno or 0. 2016-02-02 09:42:51 +03:00
man2hlp Ticket 1551: Update GPL version from 2 to 3 2011-10-18 14:08:34 +03:00
subshell Update copyright years. 2016-01-01 11:48:10 +03:00
vfs sftpfs: fix bad pointer arithmetic in config parser. 2016-02-13 16:38:40 +03:00
viewer Update copyright years. 2016-01-01 11:48:10 +03:00
.gitignore Ticket 1551: Update GPL version from 2 to 3 2011-10-18 14:08:34 +03:00
args.c Update copyright years. 2016-01-01 11:48:10 +03:00
args.h Make working with GError in more right way (like with exceptions). 2014-07-22 13:12:07 +04:00
background.c Update copyright years. 2016-01-01 11:48:10 +03:00
background.h Rename structures: 2013-11-25 13:47:40 +04:00
clipboard.c Update copyright years. 2016-01-01 11:48:10 +03:00
clipboard.h Use events for operate with clipboard (copy/paste to external clipboard, save/load to file) 2011-03-21 23:55:52 +02:00
cons.handler.c Update copyright years. 2016-01-01 11:48:10 +03:00
events_init.c Update copyright years. 2016-01-01 11:48:10 +03:00
events_init.h Prepare to initialize application events. 2011-03-21 11:46:41 +02:00
execute.c Update copyright years. 2016-01-01 11:48:10 +03:00
execute.h Remove unused function exec_shell(). 2016-01-01 11:48:09 +03:00
help.c Update copyright years. 2016-01-01 11:48:10 +03:00
help.h Typo fixes. 2013-07-23 14:15:24 +04:00
history.h fixed doxygen documentation 2012-09-10 14:29:53 +03:00
keybind-defaults.c Update copyright years. 2016-01-01 11:48:10 +03:00
keybind-defaults.h Ticket #2576: fix of symbols duplication. 2011-07-14 21:46:59 +04:00
learn.c Update copyright years. 2016-01-01 11:48:10 +03:00
learn.h Code indentation in src directory 2010-11-24 10:27:47 +03:00
main.c Update copyright years. 2016-01-01 11:48:10 +03:00
Makefile.am Ticket #3547: code cleanup before 4.8.16 release. 2016-01-01 11:48:06 +03:00
selcodepage.c Update copyright years. 2016-01-01 11:48:10 +03:00
selcodepage.h Cleanup of main.[ch]. 2010-11-24 10:51:31 +03:00
setup.c Update copyright years. 2016-01-01 11:48:10 +03:00
setup.h Use signed long instead of unsigned long for binded actions. 2016-01-01 11:48:08 +03:00
textconf.c Update copyright years. 2016-01-01 11:48:10 +03:00
textconf.h Added --configure-options for easy update & reconfigure existing mc. 2011-03-29 12:37:55 +03:00
util.c Update copyright years. 2016-01-01 11:48:10 +03:00
util.h (check_for_default): minor optimization and change return value. 2012-04-22 11:25:11 +03:00