summaryrefslogtreecommitdiff
path: root/packet-ntp.c
diff options
context:
space:
mode:
authorGerald Combs <gerald@wireshark.org>2000-11-19 21:18:10 +0000
committerGerald Combs <gerald@wireshark.org>2000-11-19 21:18:10 +0000
commitc24e26da427da32795e96589a3b761ba35f62233 (patch)
treea99a7d55be4293463bd744f822cc332f9c8d9ec0 /packet-ntp.c
parent8fa7f53b1f74275c5c01ea60eb4d4bba97cd8490 (diff)
downloadwireshark-c24e26da427da32795e96589a3b761ba35f62233.tar.gz
In dissect_ntp(), add an ellipsis (...) to the end of a reference clock ID
if its name gets truncated. svn path=/trunk/; revision=2677
Diffstat (limited to 'packet-ntp.c')
-rw-r--r--packet-ntp.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/packet-ntp.c b/packet-ntp.c
index d8eabd551e..19bd15b9a8 100644
--- a/packet-ntp.c
+++ b/packet-ntp.c
@@ -2,7 +2,7 @@
* Routines for NTP packet dissection
* Copyright 1999, Nathan Neulinger <nneul@umr.edu>
*
- * $Id: packet-ntp.c,v 1.19 2000/11/19 16:58:57 gerald Exp $
+ * $Id: packet-ntp.c,v 1.20 2000/11/19 21:18:10 gerald Exp $
*
* Ethereal - Network traffic analyzer
* By Gerald Combs <gerald@zing.org>
@@ -333,11 +333,14 @@ dissect_ntp(const u_char *pd, int offset, frame_data *fd, proto_tree *tree)
break;
}
}
- } else
- strncpy (buff, get_hostname (pntohl(pkt->refid)), sizeof buff - 1);
+ } else {
+ buff[sizeof(buff) - 1] = '\0';
+ strncpy (buff, get_hostname (pntohl(pkt->refid)), sizeof(buff));
+ if (buff[sizeof(buff) - 1] != '\0')
+ strcpy(&buff[sizeof(buff) - 4], "...");
+ }
proto_tree_add_bytes_format(ntp_tree, hf_ntp_refid, NullTVB, offset+12, 4, pkt->refid,
"Reference Clock ID: %s", buff);
- buff[sizeof buff - 1] = '\0';
/* Reference Timestamp: This is the time at which the local clock was
* last set or corrected.
*/