gsup: Fix dissecting wildcard APN names

In general, GPRS APN names are encoded like DNS strings.  However,
there is one exception: The wildcard APN '*'.  If we feed this
into the DNS decoder, it will throw an exception.

Let's explicitly check for '*' as a special case.

Change-Id: I2b346f8b067fa176b80613fdbcdada8c8a8eaa52
Related: https://osmocom.org/issues/3450
Reviewed-on: https://code.wireshark.org/review/29004
Reviewed-by: Anders Broman <a.broman58@gmail.com>
This commit is contained in:
Harald Welte 2018-08-07 17:00:08 +02:00 committed by Anders Broman
parent 299306ab19
commit 297a6fe2f7
1 changed files with 10 additions and 3 deletions

View File

@ -363,9 +363,16 @@ dissect_gsup_tlvs(tvbuff_t *tvb, int base_offs, int length, packet_info *pinfo,
proto_item_append_text(gsup_ti, ", MSISDN: %s", str);
break;
case OSMO_GSUP_ACCESS_POINT_NAME_IE:
get_dns_name(tvb, offset, len, 0, &apn, &apn_len);
proto_tree_add_string(att_tree, hf_gsup_apn, tvb, offset, len, apn);
proto_item_append_text(ti, ", %s", apn);
if (len == 1) {
guint8 ch = tvb_get_guint8(tvb, offset);
proto_tree_add_item(att_tree, hf_gsup_ie_payload, tvb, offset, len, ENC_NA);
if (ch == '*')
proto_item_append_text(ti, ", '*' (Wildcard)");
} else {
get_dns_name(tvb, offset, len, 0, &apn, &apn_len);
proto_tree_add_string(att_tree, hf_gsup_apn, tvb, offset, len, apn);
proto_item_append_text(ti, ", %s", apn);
}
break;
case OSMO_GSUP_PDP_CONTEXT_ID_IE:
proto_tree_add_item(att_tree, hf_gsup_pdp_context_id, tvb, offset, len, ENC_NA);