sae: Fix potential leak in sae_process_anti_clogging

We may receive multiple anti-clogging request messages.  We memdup the
token every time, without checking whether memory for one has already
been allocated.  Free the old token prior to allocating a new one.
This commit is contained in:
Denis Kenzior 2021-07-09 23:30:11 -05:00
parent 67be05ec3e
commit c02b1466c4
1 changed files with 1 additions and 0 deletions

View File

@ -898,6 +898,7 @@ static int sae_process_anti_clogging(struct sae_sm *sm, const uint8_t *ptr,
return -EBADMSG;
}
l_free(sm->token);
sm->token = l_memdup(ptr, len);
sm->token_len = len;
sm->sync = 0;