diff options
author | jmayer <jmayer@f5534014-38df-0310-8fa8-9805f1628bb7> | 2006-01-17 10:56:06 +0000 |
---|---|---|
committer | jmayer <jmayer@f5534014-38df-0310-8fa8-9805f1628bb7> | 2006-01-17 10:56:06 +0000 |
commit | e07a492be17fa3f29e5161770cb2ed519cbbd9c6 (patch) | |
tree | eec8a030e0874838fc6e3244b03c8394f0e311a0 /epan/dissectors/packet-wtp.c | |
parent | 3fcdc8ff7e0c743cc78c5a9a5f77536804269c1a (diff) |
packet-fcswils.c: Fix incorrect use of g_snprintf return
packet-wccp.c: Fix incorrect use of g_snprintf return
packet-cops.c: Fix incorrect use of g_snprintf return value
packet-wtp.c: Fix incorrect use of g_snprintf return value
git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@17046 f5534014-38df-0310-8fa8-9805f1628bb7
Diffstat (limited to 'epan/dissectors/packet-wtp.c')
-rw-r--r-- | epan/dissectors/packet-wtp.c | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/epan/dissectors/packet-wtp.c b/epan/dissectors/packet-wtp.c index 21954e6afe..091e4b200b 100644 --- a/epan/dissectors/packet-wtp.c +++ b/epan/dissectors/packet-wtp.c @@ -307,8 +307,9 @@ wtp_handle_tpi(proto_tree *tree, tvbuff_t *tvb) static void dissect_wtp_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { - char *szInfo, *buf; + char *szInfo; int offCur = 0; /* current offset from start of WTP data */ + size_t returned_length, str_index = 0; unsigned char b0; @@ -398,8 +399,9 @@ dissect_wtp_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) #endif /* Develop the string to put in the Info column */ - buf = szInfo + g_snprintf(szInfo, SZINFO_SIZE, "WTP %s", + returned_length = g_snprintf(szInfo, SZINFO_SIZE, "WTP %s", val_to_str(pdut, vals_wtp_pdu_type, "Unknown PDU type 0x%x")); + str_index += MIN(returned_length, SZINFO_SIZE-str_index); switch (pdut) { case INVOKE: @@ -407,7 +409,9 @@ dissect_wtp_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) TID = tvb_get_ntohs(tvb, offCur + 1); psn = 0; clsTransaction = transaction_class(tvb_get_guint8(tvb, offCur + 3)); - buf += g_snprintf(buf, SZINFO_SIZE-(buf-szInfo), " Class %d", clsTransaction); + returned_length = g_snprintf(&szInfo[str_index], SZINFO_SIZE-str_index, + " Class %d", clsTransaction); + str_index += MIN(returned_length, SZINFO_SIZE-str_index); cbHeader = 4; break; @@ -416,8 +420,11 @@ dissect_wtp_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) fTTR = transmission_trailer(b0); TID = tvb_get_ntohs(tvb, offCur + 1); psn = tvb_get_guint8(tvb, offCur + 3); - if (psn != 0) - buf += g_snprintf(buf, SZINFO_SIZE-(buf-szInfo), " (%u)", psn); + if (psn != 0) { + returned_length = g_snprintf(&szInfo[str_index], SZINFO_SIZE-str_index, + " (%u)", psn); + str_index += MIN(returned_length, SZINFO_SIZE-str_index); + } cbHeader = 4; break; @@ -446,7 +453,8 @@ dissect_wtp_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) break; }; if (fRID) { - buf += g_snprintf(buf, SZINFO_SIZE-(buf-szInfo), " R" ); + returned_length = g_snprintf(&szInfo[str_index], SZINFO_SIZE-str_index, " R" ); + str_index += MIN(returned_length, SZINFO_SIZE-str_index); }; /* In the interest of speed, if "tree" is NULL, don't do any work not necessary to generate protocol tree items. */ |