summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnders Broman <anders.broman@ericsson.com>2008-05-13 06:55:45 +0000
committerAnders Broman <anders.broman@ericsson.com>2008-05-13 06:55:45 +0000
commitd22975841b065e71cb4906dc42fb25b36a0ab31d (patch)
tree12995894e0aecdc1b77d82b99e7b1af32041ead0
parent9ca142b16012f55fb5d9334ce61a7fcbdfd0470f (diff)
downloadwireshark-d22975841b065e71cb4906dc42fb25b36a0ab31d.tar.gz
Fix some of the Errors/warnings detected by checkapi.
svn path=/trunk/; revision=25283
-rw-r--r--capture-pcap-util-unix.c2
-rw-r--r--conditions.c6
-rw-r--r--plugins/irda/Makefile.nmake2
-rw-r--r--tap-iousers.c38
4 files changed, 23 insertions, 25 deletions
diff --git a/capture-pcap-util-unix.c b/capture-pcap-util-unix.c
index 390b4d763c..2ecfa3757f 100644
--- a/capture-pcap-util-unix.c
+++ b/capture-pcap-util-unix.c
@@ -207,7 +207,7 @@ get_interface_list(int *err, char **err_str)
* Get the interface flags.
*/
memset(&ifrflags, 0, sizeof ifrflags);
- strncpy(ifrflags.ifr_name, ifr->ifr_name,
+ g_strlcpy(ifrflags.ifr_name, ifr->ifr_name,
sizeof ifrflags.ifr_name);
if (ioctl(sock, SIOCGIFFLAGS, (char *)&ifrflags) < 0) {
if (errno == ENXIO)
diff --git a/conditions.c b/conditions.c
index 95b42f7bea..33d20fe229 100644
--- a/conditions.c
+++ b/conditions.c
@@ -70,8 +70,7 @@ condition* cnd_new(const char* class_id, ...){
g_free(cnd_ref);
return NULL;
}
- strncpy(id, class_id, strlen(class_id));
- id[strlen(class_id)] = '\0';
+ g_strlcpy(id, class_id, strlen(class_id));
cnd_ref->class_id = id;
/* perform class specific initialization */
va_start(ap, class_id);
@@ -147,8 +146,7 @@ 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;
- strncpy(key, class_id, strlen(class_id));
- key[strlen(class_id)] = '\0';
+ g_strlcpy(key, class_id, strlen(class_id));
/* initialize class structure */
if((cls = (_cnd_class*)g_malloc(sizeof(_cnd_class))) == NULL){
g_free(key);
diff --git a/plugins/irda/Makefile.nmake b/plugins/irda/Makefile.nmake
index 38320642e4..151b3c060a 100644
--- a/plugins/irda/Makefile.nmake
+++ b/plugins/irda/Makefile.nmake
@@ -100,4 +100,4 @@ distclean: clean
maintainer-clean: distclean
checkapi:
-# $(PERL) ../../tools/checkAPIs.pl $(DISSECTOR_SRC)
+ $(PERL) ../../tools/checkAPIs.pl $(DISSECTOR_SRC)
diff --git a/tap-iousers.c b/tap-iousers.c
index ced4eb814e..2e3bbeec77 100644
--- a/tap-iousers.c
+++ b/tap-iousers.c
@@ -110,9 +110,9 @@ iousers_udpip_packet(void *arg, packet_info *pinfo, epan_dissect_t *edt _U_, con
iui->next=iu->items;
iu->items=iui;
/* iui->addr1=NULL;*/
- iui->name1=strdup(name1);
+ iui->name1=g_strdup(name1);
/* iui->addr2=NULL;*/
- iui->name2=strdup(name2);
+ iui->name2=g_strdup(name2);
iui->frames1=0;
iui->frames2=0;
iui->bytes1=0;
@@ -169,9 +169,9 @@ iousers_sctp_packet(void *arg, packet_info *pinfo, epan_dissect_t *edt _U_, cons
iui->next=iu->items;
iu->items=iui;
/* iui->addr1=NULL;*/
- iui->name1=strdup(name1);
+ iui->name1=g_strdup(name1);
/* iui->addr2=NULL;*/
- iui->name2=strdup(name2);
+ iui->name2=g_strdup(name2);
iui->frames1=0;
iui->frames2=0;
iui->bytes1=0;
@@ -229,9 +229,9 @@ iousers_tcpip_packet(void *arg, packet_info *pinfo, epan_dissect_t *edt _U_, con
iui->next=iu->items;
iu->items=iui;
/* iui->addr1=NULL;*/
- iui->name1=strdup(name1);
+ iui->name1=g_strdup(name1);
/* iui->addr2=NULL;*/
- iui->name2=strdup(name2);
+ iui->name2=g_strdup(name2);
iui->frames1=0;
iui->frames2=0;
iui->bytes1=0;
@@ -278,9 +278,9 @@ iousers_ip_packet(void *arg, packet_info *pinfo, epan_dissect_t *edt _U_, const
iui->next=iu->items;
iu->items=iui;
COPY_ADDRESS(&iui->addr1, addr1);
- iui->name1=strdup(address_to_str(addr1));
+ iui->name1=g_strdup(address_to_str(addr1));
COPY_ADDRESS(&iui->addr2, addr2);
- iui->name2=strdup(address_to_str(addr2));
+ iui->name2=g_strdup(address_to_str(addr2));
iui->frames1=0;
iui->frames2=0;
iui->bytes1=0;
@@ -326,9 +326,9 @@ iousers_ipx_packet(void *arg, packet_info *pinfo, epan_dissect_t *edt _U_, const
iui->next=iu->items;
iu->items=iui;
COPY_ADDRESS(&iui->addr1, addr1);
- iui->name1=strdup(address_to_str(addr1));
+ iui->name1=g_strdup(address_to_str(addr1));
COPY_ADDRESS(&iui->addr2, addr2);
- iui->name2=strdup(address_to_str(addr2));
+ iui->name2=g_strdup(address_to_str(addr2));
iui->frames1=0;
iui->frames2=0;
iui->bytes1=0;
@@ -374,9 +374,9 @@ iousers_fc_packet(void *arg, packet_info *pinfo, epan_dissect_t *edt _U_, const
iui->next=iu->items;
iu->items=iui;
COPY_ADDRESS(&iui->addr1, addr1);
- iui->name1=strdup(address_to_str(addr1));
+ iui->name1=g_strdup(address_to_str(addr1));
COPY_ADDRESS(&iui->addr2, addr2);
- iui->name2=strdup(address_to_str(addr2));
+ iui->name2=g_strdup(address_to_str(addr2));
iui->frames1=0;
iui->frames2=0;
iui->bytes1=0;
@@ -422,9 +422,9 @@ iousers_eth_packet(void *arg, packet_info *pinfo, epan_dissect_t *edt _U_, const
iui->next=iu->items;
iu->items=iui;
COPY_ADDRESS(&iui->addr1, addr1);
- iui->name1=strdup(address_to_str(addr1));
+ iui->name1=g_strdup(address_to_str(addr1));
COPY_ADDRESS(&iui->addr2, addr2);
- iui->name2=strdup(address_to_str(addr2));
+ iui->name2=g_strdup(address_to_str(addr2));
iui->frames1=0;
iui->frames2=0;
iui->bytes1=0;
@@ -470,9 +470,9 @@ iousers_fddi_packet(void *arg, packet_info *pinfo, epan_dissect_t *edt _U_, cons
iui->next=iu->items;
iu->items=iui;
COPY_ADDRESS(&iui->addr1, addr1);
- iui->name1=strdup(address_to_str(addr1));
+ iui->name1=g_strdup(address_to_str(addr1));
COPY_ADDRESS(&iui->addr2, addr2);
- iui->name2=strdup(address_to_str(addr2));
+ iui->name2=g_strdup(address_to_str(addr2));
iui->frames1=0;
iui->frames2=0;
iui->bytes1=0;
@@ -518,9 +518,9 @@ iousers_tr_packet(void *arg, packet_info *pinfo, epan_dissect_t *edt _U_, const
iui->next=iu->items;
iu->items=iui;
COPY_ADDRESS(&iui->addr1, addr1);
- iui->name1=strdup(address_to_str(addr1));
+ iui->name1=g_strdup(address_to_str(addr1));
COPY_ADDRESS(&iui->addr2, addr2);
- iui->name2=strdup(address_to_str(addr2));
+ iui->name2=g_strdup(address_to_str(addr2));
iui->frames1=0;
iui->frames2=0;
iui->bytes1=0;
@@ -691,7 +691,7 @@ iousers_init(const char *optarg, void* userdata _U_)
iu->items=NULL;
iu->type=tap_type_name;
if(filter){
- iu->filter=strdup(filter);
+ iu->filter=g_strdup(filter);
} else {
iu->filter=NULL;
}