]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
Silence static analyzer warning about null termination of a string
authorJouni Malinen <j@w1.fi>
Sun, 7 Jul 2019 07:02:40 +0000 (10:02 +0300)
committerJouni Malinen <j@w1.fi>
Sun, 7 Jul 2019 07:07:10 +0000 (10:07 +0300)
The buf[] array is initialized to zeros, so it was already null
terminated since the read() call did not allow the last character of the
buffer to be overwritten. Since that was apparently not enough to make
some static analyzers understand the design, use explicit null
termination after a successful read() call.

Signed-off-by: Jouni Malinen <j@w1.fi>
src/utils/wpa_debug.c

index c437000a7f50065795f1f0598308ef626be50c23..c336e5389d0110fb804ea389527bf3e8d6f4e69d 100644 (file)
@@ -144,6 +144,7 @@ int wpa_debug_open_linux_tracing(void)
                printf("failed to read /proc/mounts\n");
                return -1;
        }
+       buf[buflen] = '\0';
 
        line = strtok_r(buf, "\n", &tmp1);
        while (line) {