aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-sip.c
diff options
context:
space:
mode:
authorstig <stig@f5534014-38df-0310-8fa8-9805f1628bb7>2008-03-01 17:23:39 +0000
committerstig <stig@f5534014-38df-0310-8fa8-9805f1628bb7>2008-03-01 17:23:39 +0000
commit994d316315868546fa15319311187414c3b4d4f9 (patch)
tree75b52bc6b03f8df488b8acbe97063df9d6d8b02d /epan/dissectors/packet-sip.c
parentbb42d82ed760cb028118fca73c79f37e1cbc00b6 (diff)
Rewrote to use g_strlcpy and g_strlcat.
git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@24525 f5534014-38df-0310-8fa8-9805f1628bb7
Diffstat (limited to 'epan/dissectors/packet-sip.c')
-rw-r--r--epan/dissectors/packet-sip.c17
1 files changed, 6 insertions, 11 deletions
diff --git a/epan/dissectors/packet-sip.c b/epan/dissectors/packet-sip.c
index 54290b31d9..7e67599506 100644
--- a/epan/dissectors/packet-sip.c
+++ b/epan/dissectors/packet-sip.c
@@ -57,6 +57,7 @@
#include <epan/packet.h>
#include <epan/req_resp_hdrs.h>
#include <epan/emem.h>
+#include <epan/strutil.h>
#include "packet-isup.h"
#include "packet-sip.h"
@@ -2022,7 +2023,7 @@ separator_found2:
return offset - orig_offset;
}
else {
- strncpy(cseq_method, value+sub_value_offset, MIN(strlen_to_copy, MAX_CSEQ_METHOD_SIZE));
+ g_strlcpy(cseq_method, value+sub_value_offset, MAX_CSEQ_METHOD_SIZE);
/* Add CSeq method to the tree */
if (cseq_tree)
@@ -2115,10 +2116,7 @@ separator_found2:
case POS_CALL_ID :
/* Store the Call-id */
- strncpy(call_id, value,
- strlen(value)+1 < MAX_CALL_ID_SIZE ?
- strlen(value)+1 :
- MAX_CALL_ID_SIZE);
+ g_strlcpy(call_id, value, MAX_CALL_ID_SIZE);
stat_info->tap_call_id = ep_strdup(call_id);
/* Add 'Call-id' string item to tree */
@@ -2743,10 +2741,8 @@ guint sip_is_packet_resend(packet_info *pinfo,
/* No packet entry found, consult global hash table */
/* Prepare the key */
- strncpy(key.call_id, call_id,
- (strlen(call_id)+1 <= MAX_CALL_ID_SIZE) ?
- strlen(call_id)+1 :
- MAX_CALL_ID_SIZE);
+ g_strlcpy(key.call_id, call_id, MAX_CALL_ID_SIZE);
+
/* We're only using these addresses locally (for the hash lookup) so
* there is no need to make a (g_malloc'd) copy of them.
*/
@@ -2787,8 +2783,7 @@ guint sip_is_packet_resend(packet_info *pinfo,
p_key->source_port = pinfo->srcport;
p_val->cseq = cseq_number;
- strncpy(p_val->method, cseq_method, MAX_CSEQ_METHOD_SIZE-1);
- p_val->method[MAX_CSEQ_METHOD_SIZE-1] = '\0';
+ g_strlcpy(p_val->method, cseq_method, MAX_CSEQ_METHOD_SIZE);
p_val->transaction_state = nothing_seen;
p_val->frame_number = 0;