Skip to content

Commit

Permalink
Silencing sizeof() warning
Browse files Browse the repository at this point in the history
Here, the sizeof() function return the size of 'char *' instead of 
INTF_NAME_LEN. I replaced the use of the latter function by INTF_NAME_LEN 
(maximum size of the array intf_name). Here is the compiler warning output:

route-bsd.c:171:38: warning: sizeof on array function parameter will return 
size of 'char *' instead of 'char [16]' [-Wsizeof-array-argument] 
strlcpy(intf_name, namebuf, sizeof(intf_name));
  • Loading branch information
vincent committed Jul 1, 2016
1 parent d0774e7 commit 900f015
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion libdnet-stripped/src/route-bsd.c
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ route_msg(route_t *r, int type, char intf_name[INTF_NAME_LEN], struct addr *dst,
errno = ESRCH;
return (-1);
}
strlcpy(intf_name, namebuf, sizeof(intf_name));
strlcpy(intf_name, namebuf, INTF_NAME_LEN);
}
}
return (0);
Expand Down

0 comments on commit 900f015

Please sign in to comment.