diff options
author | oabad <oabad@f5534014-38df-0310-8fa8-9805f1628bb7> | 2002-10-14 19:45:08 +0000 |
---|---|---|
committer | oabad <oabad@f5534014-38df-0310-8fa8-9805f1628bb7> | 2002-10-14 19:45:08 +0000 |
commit | dccbd571ba75f3ddf811780669395a6304ed1813 (patch) | |
tree | 5767f7f234b6e1380ffb569c28c4eae03e9f30d5 /tap.c | |
parent | 75907ec933d98f1d2f3e8f0fd915ce24ae9243cf (diff) |
1- We were writing 1 byte past the end of the buffer in register_tap
(bug found with valgrind) :
td->name = malloc(strlen(name));
strcpy(td->name, name);
Replaced with :
td->name = g_strdup(name);
2 - Use g_malloc instead of malloc (both were used).
git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@6417 f5534014-38df-0310-8fa8-9805f1628bb7
Diffstat (limited to 'tap.c')
-rw-r--r-- | tap.c | 9 |
1 files changed, 4 insertions, 5 deletions
@@ -1,7 +1,7 @@ /* tap.c * packet tap interface 2002 Ronnie Sahlberg * - * $Id: tap.c,v 1.3 2002/09/14 07:42:52 sahlberg Exp $ + * $Id: tap.c,v 1.4 2002/10/14 19:45:08 oabad Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@ethereal.com> @@ -96,7 +96,7 @@ tap_init(void) tap_packet_t *tpt; for(i=0;i<TAP_PACKET_QUEUE_LEN;i++){ - tpt=malloc(sizeof(tap_packet_t)); + tpt=g_malloc(sizeof(tap_packet_t)); tpt->next=tap_packet_list_free; tap_packet_list_free=tpt; } @@ -133,10 +133,9 @@ register_tap(char *name) tap_dissector_t *td, *tdl; int i; - td=malloc(sizeof(tap_dissector_t)); + td=g_malloc(sizeof(tap_dissector_t)); td->next=NULL; - td->name=malloc(strlen(name)); - strcpy(td->name, name); + td->name = g_strdup(name); if(!tap_dissector_list){ tap_dissector_list=td; |