Fixed sparse warnings about integer vs. pointer use
The configuration parsing functions seemed to have worked fine before, but these were real bugs even if they did not show up in practice. hostapd_ip_diff() was broken for IPv6 addresses (overwrote address and always returned 1.
This commit is contained in:
parent
d953d9ab80
commit
5306f43fc3
2 changed files with 4 additions and 5 deletions
|
@ -411,7 +411,7 @@ static int hostapd_config_read_wpa_psk(const char *fname,
|
||||||
os_memcpy(psk->addr, addr, ETH_ALEN);
|
os_memcpy(psk->addr, addr, ETH_ALEN);
|
||||||
|
|
||||||
pos = buf + 17;
|
pos = buf + 17;
|
||||||
if (pos == '\0') {
|
if (*pos == '\0') {
|
||||||
printf("No PSK on line %d in '%s'\n", line, fname);
|
printf("No PSK on line %d in '%s'\n", line, fname);
|
||||||
os_free(psk);
|
os_free(psk);
|
||||||
ret = -1;
|
ret = -1;
|
||||||
|
@ -800,7 +800,7 @@ static int hostapd_config_parse_key_mgmt(int line, const char *value)
|
||||||
return -1;
|
return -1;
|
||||||
start = buf;
|
start = buf;
|
||||||
|
|
||||||
while (start != '\0') {
|
while (*start != '\0') {
|
||||||
while (*start == ' ' || *start == '\t')
|
while (*start == ' ' || *start == '\t')
|
||||||
start++;
|
start++;
|
||||||
if (*start == '\0')
|
if (*start == '\0')
|
||||||
|
@ -858,7 +858,7 @@ static int hostapd_config_parse_cipher(int line, const char *value)
|
||||||
return -1;
|
return -1;
|
||||||
start = buf;
|
start = buf;
|
||||||
|
|
||||||
while (start != '\0') {
|
while (*start != '\0') {
|
||||||
while (*start == ' ' || *start == '\t')
|
while (*start == ' ' || *start == '\t')
|
||||||
start++;
|
start++;
|
||||||
if (*start == '\0')
|
if (*start == '\0')
|
||||||
|
|
|
@ -53,8 +53,7 @@ int hostapd_ip_diff(struct hostapd_ip_addr *a, struct hostapd_ip_addr *b)
|
||||||
break;
|
break;
|
||||||
#ifdef CONFIG_IPV6
|
#ifdef CONFIG_IPV6
|
||||||
case AF_INET6:
|
case AF_INET6:
|
||||||
if (os_memcpy(&a->u.v6, &b->u.v6, sizeof(a->u.v6))
|
if (os_memcmp(&a->u.v6, &b->u.v6, sizeof(a->u.v6)) != 0)
|
||||||
!= 0)
|
|
||||||
return 1;
|
return 1;
|
||||||
break;
|
break;
|
||||||
#endif /* CONFIG_IPV6 */
|
#endif /* CONFIG_IPV6 */
|
||||||
|
|
Loading…
Reference in a new issue