ntp: remove size constraint for invalid refid.

When the refid contains non-ascii chars, the conversion function
returns a string longer than 4 chars. This results in an invalid
string if the output is limited to 4 bytes. Incidentally this
results in an invalid PDML output as well that caught this bug
in the first place.

Fix: #17112.
This commit is contained in:
Dario Lombardo 2020-12-28 19:03:08 +01:00
parent 564a52be19
commit 39da36ad6e
No known key found for this signature in database
GPG Key ID: A45A48B6693FB191
1 changed files with 1 additions and 1 deletions

View File

@ -1254,7 +1254,7 @@ dissect_ntp_std(tvbuff_t *tvb, packet_info *pinfo, proto_tree *ntp_tree, ntp_con
*/
buff = (gchar *)wmem_alloc(wmem_packet_scope(), NTP_TS_SIZE);
if (stratum <= 1) {
g_snprintf (buff, NTP_TS_SIZE, "Unidentified reference source '%.4s'",
g_snprintf (buff, NTP_TS_SIZE, "Unidentified reference source '%s'",
tvb_get_string_enc(wmem_packet_scope(), tvb, 12, 4, ENC_ASCII));
for (i = 0; primary_sources[i].id; i++) {
if (tvb_memeql(tvb, 12, primary_sources[i].id, 4) == 0) {