Parent: 8980962fb9591b78521d0cf87ca463cc45bdc55c
Author: Lukasz Rymanowski <lukasz.rymanowski@tieto.com>
Committer: Johan Hedberg <johan.hedberg@intel.com>
Date: 2015-03-27 07:35:27
Tree: 0d117a488d4928bc2faf182904a4f0c0e9c5ee8a
tools/btmgmt: Fix crash in interactive mode Optind needs to be reset to 0 so getopt_long do reinitialization on new parsing. Otherwise we got crash: [hci1]# find --help Usage: find [-l|-b]> [hci1]# find --help ==16382== Invalid read of size 1 ==16382== at 0x513CA96: _getopt_internal_r (getopt.c:429) ==16382== by 0x513DBFA: _getopt_internal (getopt.c:1177) ==16382== by 0x513DC82: getopt_long (getopt1.c:66) ==16382== by 0x406721: cmd_find (btmgmt.c:2111) ==16382== by 0x40C712: rl_handler (btmgmt.c:4275) ==16382== by 0x4E5A727: rl_callback_read_char (in /lib/x86_64-linux-gnu/libreadline.so.6.2) ==16382== by 0x402ED8: prompt_read (btmgmt.c:4340) ==16382== by 0x41D117: io_callback (io-mainloop.c:123) ==16382== by 0x41D9F3: mainloop_run (mainloop.c:157) ==16382== by 0x4026C2: main (btmgmt.c:4427) ==16382== Address 0x567e576 is 6 bytes inside a block of size 101 free'd ==16382== at 0x4C2A82E: free (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so) ==16382== by 0x5158DE8: wordfree (wordexp.c:2235) ==16382== by 0x40C71A: rl_handler (btmgmt.c:4304) ==16382== by 0x4E5A727: rl_callback_read_char (in /lib/x86_64-linux-gnu/libreadline.so.6.2) ==16382== by 0x402ED8: prompt_read (btmgmt.c:4340) ==16382== by 0x41D117: io_callback (io-mainloop.c:123) ==16382== by 0x41D9F3: mainloop_run (mainloop.c:157) ==16382== by 0x4026C2: main (btmgmt.c:4427) ==16382==
Diffstat
| M | tools/btmgmt.c | | | 23 | +++++++++++++++++++++++ |
1 files changed, 23 insertions(+), 0 deletions(-)