From: Jouni Malinen Date: Sat, 10 Jan 2015 15:31:37 +0000 (+0200) Subject: trace: Fix out-of-memory testing logic X-Git-Tag: hostap_2_4~463 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8a42a076aaf26e564f2407555b452136bdbde5f7;p=thirdparty%2Fhostap.git 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 --- diff --git a/src/utils/trace.c b/src/utils/trace.c index 2673753eb..8484d277d 100644 --- a/src/utils/trace.c +++ b/src/utils/trace.c @@ -272,9 +272,10 @@ size_t wpa_trace_calling_func(const char *buf[], size_t len) data.found = FALSE; bfd_map_over_sections(abfd, find_addr_sect, &data); - while (data.found || !data.function) { - if (pos > 0 || - os_strcmp(data.function, __func__) != 0) { + while (data.found) { + if (data.function && + (pos > 0 || + os_strcmp(data.function, __func__) != 0)) { buf[pos++] = data.function; if (pos == len) return pos;