mirror of
https://github.com/vanhoefm/fragattacks.git
synced 2024-11-25 00:38:24 -05:00
Free old eap_user_file data on configuration change
This fixes a memory leak if hostapd eap_user_file parameter is modified. Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
This commit is contained in:
parent
3b86e9d52c
commit
4437f8fc77
@ -216,7 +216,7 @@ static int hostapd_config_read_eap_user(const char *fname,
|
|||||||
FILE *f;
|
FILE *f;
|
||||||
char buf[512], *pos, *start, *pos2;
|
char buf[512], *pos, *start, *pos2;
|
||||||
int line = 0, ret = 0, num_methods;
|
int line = 0, ret = 0, num_methods;
|
||||||
struct hostapd_eap_user *user = NULL, *tail = NULL;
|
struct hostapd_eap_user *user = NULL, *tail = NULL, *new_user = NULL;
|
||||||
|
|
||||||
if (!fname)
|
if (!fname)
|
||||||
return 0;
|
return 0;
|
||||||
@ -494,7 +494,7 @@ static int hostapd_config_read_eap_user(const char *fname,
|
|||||||
|
|
||||||
done:
|
done:
|
||||||
if (tail == NULL) {
|
if (tail == NULL) {
|
||||||
tail = conf->eap_user = user;
|
tail = new_user = user;
|
||||||
} else {
|
} else {
|
||||||
tail->next = user;
|
tail->next = user;
|
||||||
tail = user;
|
tail = user;
|
||||||
@ -510,6 +510,18 @@ static int hostapd_config_read_eap_user(const char *fname,
|
|||||||
|
|
||||||
fclose(f);
|
fclose(f);
|
||||||
|
|
||||||
|
if (ret == 0) {
|
||||||
|
user = conf->eap_user;
|
||||||
|
while (user) {
|
||||||
|
struct hostapd_eap_user *prev;
|
||||||
|
|
||||||
|
prev = user;
|
||||||
|
user = user->next;
|
||||||
|
hostapd_config_free_eap_user(prev);
|
||||||
|
}
|
||||||
|
conf->eap_user = new_user;
|
||||||
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
#endif /* EAP_SERVER */
|
#endif /* EAP_SERVER */
|
||||||
|
Loading…
Reference in New Issue
Block a user