diff options
author | stig <stig@f5534014-38df-0310-8fa8-9805f1628bb7> | 2008-01-24 23:01:37 +0000 |
---|---|---|
committer | stig <stig@f5534014-38df-0310-8fa8-9805f1628bb7> | 2008-01-24 23:01:37 +0000 |
commit | 9ccbfdfc10c7adc7a3f2b6368c94fdbf5435cfea (patch) | |
tree | 4ee6de345288ff1cd3b9fec71b014bb0106f87f9 | |
parent | 62108e0949759e148c9817241d83db5807e5f7a7 (diff) |
Fixed some strcpy -> strncpy/g_snprintf cleanups.
Removed a debug printout in t38.
git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@24188 f5534014-38df-0310-8fa8-9805f1628bb7
-rw-r--r-- | asn1/t38/packet-t38-template.c | 5 | ||||
-rw-r--r-- | capture_loop.c | 4 | ||||
-rw-r--r-- | conditions.c | 6 | ||||
-rw-r--r-- | editcap.c | 2 | ||||
-rw-r--r-- | epan/dissectors/packet-t38.c | 15 | ||||
-rw-r--r-- | epan/dissectors/packet-t38.h | 2 |
6 files changed, 17 insertions, 17 deletions
diff --git a/asn1/t38/packet-t38-template.c b/asn1/t38/packet-t38-template.c index a87467526c..3dea633819 100644 --- a/asn1/t38/packet-t38-template.c +++ b/asn1/t38/packet-t38-template.c @@ -232,8 +232,6 @@ void t38_add_address(packet_info *pinfo, return; } - printf("#%u: t38_add_address(%s, %u, %u, %s, %u\n", pinfo->fd->num, address_to_str(addr), port, other_port, setup_method, setup_frame_number); - SET_ADDRESS(&null_addr, AT_NONE, 0, NULL); /* @@ -480,7 +478,8 @@ init_t38_info_conv(packet_info *pinfo) /* copy the t38 conversation info to the packet t38 conversation */ p_t38_packet_conv = se_alloc(sizeof(t38_conv)); - strcpy(p_t38_packet_conv->setup_method, p_t38_conv->setup_method); + strncpy(p_t38_packet_conv->setup_method, p_t38_conv->setup_method, MAX_T38_SETUP_METHOD_SIZE); + p_t38_packet_conv->setup_method[MAX_T38_SETUP_METHOD_SIZE] = '\0'; p_t38_packet_conv->setup_frame_number = p_t38_conv->setup_frame_number; memcpy(&(p_t38_packet_conv->src_t38_info), &(p_t38_conv->src_t38_info), sizeof(t38_conv_info)); diff --git a/capture_loop.c b/capture_loop.c index 8c602a4a16..38f7e34674 100644 --- a/capture_loop.c +++ b/capture_loop.c @@ -990,12 +990,12 @@ capture_loop_init_output(capture_options *capture_opts, int save_file_fd, loop_d switch (err) { case WTAP_ERR_CANT_OPEN: - strcpy(errmsg, "The file to which the capture would be saved" + g_snprintf(errmsg, errmsg_len, "The file to which the capture would be saved" " couldn't be created for some unknown reason."); break; case WTAP_ERR_SHORT_WRITE: - strcpy(errmsg, "A full header couldn't be written to the file" + g_snprintf(errmsg, errmsg_len, "A full header couldn't be written to the file" " to which the capture would be saved."); break; diff --git a/conditions.c b/conditions.c index b6276e7ca2..95b42f7bea 100644 --- a/conditions.c +++ b/conditions.c @@ -70,7 +70,8 @@ condition* cnd_new(const char* class_id, ...){ g_free(cnd_ref); return NULL; } - strcpy(id, class_id); + strncpy(id, class_id, strlen(class_id)); + id[strlen(class_id)] = '\0'; cnd_ref->class_id = id; /* perform class specific initialization */ va_start(ap, class_id); @@ -146,7 +147,8 @@ gboolean cnd_register_class(const char* class_id, /* GHashTable keys need to be persistent for the lifetime of the hash table. Allocate memory and copy the class id which we use as key. */ if((key = (char*)g_malloc(strlen(class_id)+1)) == NULL) return FALSE; - strcpy(key, class_id); + strncpy(key, class_id, strlen(class_id)); + key[strlen(class_id)] = '\0'; /* initialize class structure */ if((cls = (_cnd_class*)g_malloc(sizeof(_cnd_class))) == NULL){ g_free(key); @@ -765,7 +765,7 @@ int main(int argc, char *argv[]) if (err_type < ERR_WT_FMT) { if ((unsigned int)i < phdr->caplen - 2) - strcpy((char*) &buf[i], "%s"); + strncpy((char*) &buf[i], "%s", 2); err_type = ERR_WT_TOTAL; } else { err_type -= ERR_WT_FMT; diff --git a/epan/dissectors/packet-t38.c b/epan/dissectors/packet-t38.c index c52f2cb48c..0129bf4a04 100644 --- a/epan/dissectors/packet-t38.c +++ b/epan/dissectors/packet-t38.c @@ -1,7 +1,7 @@ /* Do not modify this file. */ /* It is created automatically by the ASN.1 to Wireshark dissector compiler */ /* packet-t38.c */ -/* ../../tools/asn2wrs.py -p t38 -c t38.cnf -s packet-t38-template T38_2002.asn */ +/* ../../tools/asn2wrs.py -p t38 -c ./t38.cnf -s ./packet-t38-template -D . T38_2002.asn */ /* Input file: packet-t38-template.c */ @@ -277,8 +277,6 @@ void t38_add_address(packet_info *pinfo, return; } - printf("#%u: t38_add_address(%s, %u, %u, %s, %u\n", pinfo->fd->num, address_to_str(addr), port, other_port, setup_method, setup_frame_number); - SET_ADDRESS(&null_addr, AT_NONE, 0, NULL); /* @@ -808,7 +806,7 @@ dissect_t38_IFPPacket(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, p static int dissect_t38_T_seq_number(tvbuff_t *tvb _U_, int offset _U_, asn1_ctx_t *actx _U_, proto_tree *tree _U_, int hf_index _U_) { offset = dissect_per_constrained_integer(tvb, offset, actx, tree, hf_index, - 0U, 65535U, &seq_number, FALSE); + 0U, 65535U, &seq_number, FALSE); #line 232 "t38.cnf" /* info for tap */ @@ -979,7 +977,7 @@ static int dissect_UDPTLPacket_PDU(tvbuff_t *tvb _U_, packet_info *pinfo _U_, pr /*--- End of included file: packet-t38-fn.c ---*/ -#line 402 "packet-t38-template.c" +#line 400 "packet-t38-template.c" /* initialize the tap t38_info and the conversation */ static void @@ -1061,7 +1059,8 @@ init_t38_info_conv(packet_info *pinfo) /* copy the t38 conversation info to the packet t38 conversation */ p_t38_packet_conv = se_alloc(sizeof(t38_conv)); - strcpy(p_t38_packet_conv->setup_method, p_t38_conv->setup_method); + strncpy(p_t38_packet_conv->setup_method, p_t38_conv->setup_method, MAX_T38_SETUP_METHOD_SIZE); + p_t38_packet_conv->setup_method[MAX_T38_SETUP_METHOD_SIZE] = '\0'; p_t38_packet_conv->setup_frame_number = p_t38_conv->setup_frame_number; memcpy(&(p_t38_packet_conv->src_t38_info), &(p_t38_conv->src_t38_info), sizeof(t38_conv_info)); @@ -1350,7 +1349,7 @@ proto_register_t38(void) "t38.OCTET_STRING", HFILL }}, /*--- End of included file: packet-t38-hfarr.c ---*/ -#line 696 "packet-t38-template.c" +#line 695 "packet-t38-template.c" { &hf_t38_setup, { "Stream setup", "t38.setup", FT_STRING, BASE_NONE, NULL, 0x0, "Stream setup, method and frame number", HFILL }}, @@ -1405,7 +1404,7 @@ proto_register_t38(void) &ett_t38_T_fec_data, /*--- End of included file: packet-t38-ettarr.c ---*/ -#line 737 "packet-t38-template.c" +#line 736 "packet-t38-template.c" &ett_t38_setup, &ett_data_fragment, &ett_data_fragments diff --git a/epan/dissectors/packet-t38.h b/epan/dissectors/packet-t38.h index 0d3af6db3a..a33b22868b 100644 --- a/epan/dissectors/packet-t38.h +++ b/epan/dissectors/packet-t38.h @@ -1,7 +1,7 @@ /* Do not modify this file. */ /* It is created automatically by the ASN.1 to Wireshark dissector compiler */ /* packet-t38.h */ -/* ../../tools/asn2wrs.py -p t38 -c t38.cnf -s packet-t38-template T38_2002.asn */ +/* ../../tools/asn2wrs.py -p t38 -c ./t38.cnf -s ./packet-t38-template -D . T38_2002.asn */ /* Input file: packet-t38-template.h */ |