Fix some of the Errors/warnings detected by checkapi.

svn path=/trunk/; revision=25283
This commit is contained in:
Anders Broman 2008-05-13 06:55:45 +00:00
parent 9ca142b160
commit d22975841b
4 changed files with 23 additions and 25 deletions

View File

@ -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)

View File

@ -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);

View File

@ -100,4 +100,4 @@ distclean: clean
maintainer-clean: distclean
checkapi:
# $(PERL) ../../tools/checkAPIs.pl $(DISSECTOR_SRC)
$(PERL) ../../tools/checkAPIs.pl $(DISSECTOR_SRC)

View File

@ -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;
}