forked from osmocom/wireshark
prefs: fix crash when setting certain obsolete port preferences
Loading an old Wireshark profile with certain deprecated preferences could result in a crash due to type confusion. If the new preference was a range type, then four bytes of the pointer (address) to the range was overwritten with the numeric value of the deprecated preference. Minimal reproducer: tshark -opgm.udp.encap_ucast_port:0 -r ../test/captures/empty.pcap Bug: 14316 Change-Id: Ia8dc24f81f6b2e6494448dadffe810606765cb9e Fixes: v2.3.0rc0-971-g268841f3e0 ("Combine Decode As and port preferences for tcp.port dissector table.") Reviewed-on: https://code.wireshark.org/review/27226 Petri-Dish: Peter Wu <peter@lekensteyn.nl> Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman <a.broman58@gmail.com>
This commit is contained in:
parent
82824fd394
commit
2ed9115a4b
13
epan/prefs.c
13
epan/prefs.c
|
@ -5194,10 +5194,17 @@ deprecated_port_pref(gchar *pref_name, const gchar *value)
|
|||
|
||||
module = prefs_find_module(port_prefs[i].module_name);
|
||||
pref = prefs_find_preference(module, port_prefs[i].table_name);
|
||||
if (pref != NULL)
|
||||
{
|
||||
if (pref != NULL) {
|
||||
module->prefs_changed_flags |= prefs_get_effect_flags(pref);
|
||||
*pref->varp.uint = uval;
|
||||
if (pref->type == PREF_DECODE_AS_UINT) {
|
||||
*pref->varp.uint = uval;
|
||||
} else if (pref->type == PREF_DECODE_AS_RANGE) {
|
||||
// The legacy preference was a port number, but the new
|
||||
// preference is a port range. Add to existing range.
|
||||
if (uval) {
|
||||
prefs_range_add_value(pref, uval);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* If the value is zero, it wouldn't add to the Decode As tables */
|
||||
|
|
Loading…
Reference in New Issue