From 819ad5b70b0cb2d3ed64c11aa4cbf11c9a3fc698 Mon Sep 17 00:00:00 2001 From: Ayala Beker Date: Thu, 10 Dec 2015 12:56:03 +0200 Subject: [PATCH] utils: Fix NULL pointer dereference with unexpected kernel behavior Fix mostly theoretical NULL pointer dereference in wpa_debug_open_linux_tracing() if /proc/mounts were to return a malformed line. Signed-off-by: Ayala Beker --- src/utils/wpa_debug.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/utils/wpa_debug.c b/src/utils/wpa_debug.c index 3275524f6..f7acf6b9f 100644 --- a/src/utils/wpa_debug.c +++ b/src/utils/wpa_debug.c @@ -148,7 +148,7 @@ int wpa_debug_open_linux_tracing(void) strtok_r(line, " ", &tmp2); tmp_path = strtok_r(NULL, " ", &tmp2); fstype = strtok_r(NULL, " ", &tmp2); - if (strcmp(fstype, "debugfs") == 0) { + if (fstype && strcmp(fstype, "debugfs") == 0) { path = tmp_path; break; }