Wireshark-commits: [Wireshark-commits] master 878f341: prefs: fix ASAN error due to invalid indirec
URL: https://code.wireshark.org/review/gitweb?p=wireshark.git;a=commit;h=878f341ffad0f0281c3650d5c7a9d9b203f8b2c1
Submitter: Michael Mann (mmann78@xxxxxxxxxxxx)
Changed: branch: master
Repository: wireshark
Commits:
878f341 by Peter Wu (peter@xxxxxxxxxxxxx):
prefs: fix ASAN error due to invalid indirection
For pref_current, indirection of pref->varp.string will cause a read of
size 8. This will cause a global buffer overflow error for all smaller
types, for example lbmc_use_heuristic_subdissectors (size 4).
Reproduce: compile Wireshark with -fsanitize=address, open Preferences
and select OK or Apply. Result: ASAN crash.
To fix this, only indirect a pointer if the storage size is known, a
void pointer stores the address of the constant value (pref_default,
pref_stashed) or the address to the value (pref_current). Note that
pointers of different types are of equal size, I could take
valp.pref_(anything).
While at it, remove superfluous 'break' keywords where a 'return'
keyword is present.
Change-Id: I05a69e8f14a1ecb4e5d2a0c0f0b71ed3f0a41d70
Reviewed-on: https://code.wireshark.org/review/1286
Reviewed-by: Evan Huus <eapache@xxxxxxxxx>
Reviewed-by: Michael Mann <mmann78@xxxxxxxxxxxx>
Actions performed:
from 5600ae1 http: Fix src/dest mapping for proxied connections
adds 878f341 prefs: fix ASAN error due to invalid indirection
Summary of changes:
epan/prefs.c | 43 ++++++++++++++-----------------------------
1 file changed, 14 insertions(+), 29 deletions(-)