]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
trace: Fix out-of-memory testing logic
authorJouni Malinen <j@w1.fi>
Sat, 10 Jan 2015 15:31:37 +0000 (17:31 +0200)
committerJouni Malinen <j@w1.fi>
Sat, 10 Jan 2015 15:35:53 +0000 (17:35 +0200)
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>
src/utils/trace.c

index 2673753ebfe8e9327408bc314aaee1fa43e4e7c2..8484d277d24b66c439e71d0834b0f5fd5a31e6a3 100644 (file)
@@ -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;