Use strcmp instead of sizeof on char* string
This bug was detected by the clang warning: libsocketcan.c:384:16: warning: argument to 'sizeof' in 'strncmp' call is the same expression as the source; did you mean to provide an explicit length? [-Wsizeof-pointer-memaccess] sizeof(name)) != 0) ~~~~~~~^~~~~~ Signed-off-by: Alexander Stein <alexander.stein@systec-electronic.com> Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>pull/106/head^2
parent
58f117aa51
commit
94094cc4ee
|
|
@ -379,9 +379,8 @@ static int do_get_nl_link(int fd, __u8 acquire, const char *name, void *res)
|
|||
nl_msg->nlmsg_len - NLMSG_LENGTH(sizeof(struct ifaddrmsg));
|
||||
parse_rtattr(tb, IFLA_MAX, IFLA_RTA(ifi), len);
|
||||
|
||||
if (strncmp
|
||||
((char *)RTA_DATA(tb[IFLA_IFNAME]), name,
|
||||
sizeof(name)) != 0)
|
||||
if (strcmp
|
||||
((char *)RTA_DATA(tb[IFLA_IFNAME]), name) != 0)
|
||||
continue;
|
||||
|
||||
if (tb[IFLA_LINKINFO])
|
||||
|
|
|
|||
Loading…
Reference in New Issue