From 3c0daa13d5a4c43e4015e0fcd331f005dcdafe0b Mon Sep 17 00:00:00 2001 From: Jouni Malinen Date: Mon, 19 Jun 2017 21:28:37 +0300 Subject: [PATCH] Make wpa_config_read_blob() easier for static analyzers While encoded == NULL could happen in the case of an empty blob, that will result in encoded_len == 0 and base64_decode() not derefencing the src argument. That seems to be too difficult for some static analyzers, so to avoid false warnings, explicitly reject the encoded == NULL case without even trying to base64 decode it. (CID 164709) Signed-off-by: Jouni Malinen --- wpa_supplicant/config_file.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wpa_supplicant/config_file.c b/wpa_supplicant/config_file.c index 46a9e0b1e..dead8ad1f 100644 --- a/wpa_supplicant/config_file.c +++ b/wpa_supplicant/config_file.c @@ -312,7 +312,7 @@ static struct wpa_config_blob * wpa_config_read_blob(FILE *f, int *line, encoded_len += len; } - if (!end) { + if (!end || !encoded) { wpa_printf(MSG_ERROR, "Line %d: blob was not terminated " "properly", *line); os_free(encoded);