trace: Fix out-of-memory testing logic
data.function needs to be set for the return value to be of any use and strcmp won't work with NULL pointer either. (CID 99907) Signed-off-by: Jouni Malinen <j@w1.fi>
This commit is contained in:
parent
c2096d9981
commit
8a42a076aa
1 changed files with 4 additions and 3 deletions
|
@ -272,9 +272,10 @@ size_t wpa_trace_calling_func(const char *buf[], size_t len)
|
||||||
data.found = FALSE;
|
data.found = FALSE;
|
||||||
bfd_map_over_sections(abfd, find_addr_sect, &data);
|
bfd_map_over_sections(abfd, find_addr_sect, &data);
|
||||||
|
|
||||||
while (data.found || !data.function) {
|
while (data.found) {
|
||||||
if (pos > 0 ||
|
if (data.function &&
|
||||||
os_strcmp(data.function, __func__) != 0) {
|
(pos > 0 ||
|
||||||
|
os_strcmp(data.function, __func__) != 0)) {
|
||||||
buf[pos++] = data.function;
|
buf[pos++] = data.function;
|
||||||
if (pos == len)
|
if (pos == len)
|
||||||
return pos;
|
return pos;
|
||||||
|
|
Loading…
Reference in a new issue