diff options
author | Iain R. Learmonth <irl@fsfe.org> | 2019-10-29 22:22:17 +0000 |
---|---|---|
committer | Roland Knall <rknall@gmail.com> | 2019-11-03 13:15:49 +0000 |
commit | e1572a6709c85fcce987c83420b7c222b5ed5dca (patch) | |
tree | 7b8d369b59bfb75d9619a0633822e423a3f61174 /epan/address_types.c | |
parent | 530c30e8a8e7c1fd5f33d086877e2c562a505948 (diff) |
ax25: Fix addresses with non-zero SSIDs
Change-Id: Ib718ff56e9f9f5174d09579b7ad85aca18ac9a54
Reviewed-on: https://code.wireshark.org/review/34887
Reviewed-by: Peter Wu <peter@lekensteyn.nl>
Petri-Dish: Peter Wu <peter@lekensteyn.nl>
Tested-by: Petri Dish Buildbot
Reviewed-by: Roland Knall <rknall@gmail.com>
Diffstat (limited to 'epan/address_types.c')
-rw-r--r-- | epan/address_types.c | 26 |
1 files changed, 16 insertions, 10 deletions
diff --git a/epan/address_types.c b/epan/address_types.c index 0ad222b79b..260dc96b51 100644 --- a/epan/address_types.c +++ b/epan/address_types.c @@ -446,24 +446,30 @@ static int ib_str_len(const address* addr _U_) static int ax25_addr_to_str(const address* addr, gchar *buf, int buf_len _U_) { const guint8 *addrdata = (const guint8 *)addr->data; + int i, ssid; gchar *bufp = buf; - *bufp++ = printable_char_or_period(addrdata[0] >> 1); - *bufp++ = printable_char_or_period(addrdata[1] >> 1); - *bufp++ = printable_char_or_period(addrdata[2] >> 1); - *bufp++ = printable_char_or_period(addrdata[3] >> 1); - *bufp++ = printable_char_or_period(addrdata[4] >> 1); - *bufp++ = printable_char_or_period(addrdata[5] >> 1); - *bufp++ = '-'; - bufp = uint_to_str_back(bufp, (addrdata[6] >> 1) & 0x0f); - *bufp++ = '\0'; /* NULL terminate */ + for (i = 0; i < 6; i++) { + if (addrdata[i] == 0x40) { + /* end of callsign, start of space-padding */ + break; + } + *bufp++ = printable_char_or_period(addrdata[i] >> 1); + } + + ssid = (addrdata[6] >> 1) & 0x0f; + if (ssid != 0) { + bufp += g_snprintf(bufp,buf_len-(int)(bufp-buf),"-%d",ssid); + } else { + *bufp++ = '\0'; /* NULL terminate */ + } return (int)(bufp - buf); } static int ax25_addr_str_len(const address* addr _U_) { - return 21; /* Leaves extra space (10 bytes) just for uint_to_str_back() */ + return 10; /* callsign (6) + dash (1) + ssid (2) + nul (1) = 10 */ } static const char* ax25_col_filter_str(const address* addr _U_, gboolean is_src) |