diff options
author | Paul Stewart <pstew@google.com> | 2016-03-18 18:14:26 -0700 |
---|---|---|
committer | Paul Stewart <pstew@google.com> | 2016-03-18 18:30:20 -0700 |
commit | 9c42c0b70b5f606ea61e879072a5da1a8f67d13a (patch) | |
tree | 68fbafd678ced5acd3d881da7c78b15e499fe871 | |
parent | 85c72c6156e81a281e7596a1ebfaf355c56d1520 (diff) | |
download | wpa_supplicant_8-9c42c0b70b5f606ea61e879072a5da1a8f67d13a.tar.gz |
Guard against return value already being null
If there is no retrieved parameter, we should not de-reference null
Bug: 27748546
Change-Id: I8e6ceba26ab7d73ab365b72c0bfdcdb0a36a59a7
-rw-r--r-- | wpa_supplicant/config.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/wpa_supplicant/config.c b/wpa_supplicant/config.c index 4565329b..c952c29d 100644 --- a/wpa_supplicant/config.c +++ b/wpa_supplicant/config.c @@ -2218,8 +2218,10 @@ char * wpa_config_get(struct wpa_ssid *ssid, const char *var) const struct parse_data *field = &ssid_fields[i]; if (os_strcmp(var, field->name) == 0) { char *ret = field->writer(field, ssid); - if (os_strchr(ret, '\r') != NULL || os_strchr(ret, '\n') != NULL) { - wpa_printf(MSG_ERROR, "Found newline in value for %s; " + if (ret != NULL && (os_strchr(ret, '\r') != NULL || + os_strchr(ret, '\n') != NULL)) { + wpa_printf(MSG_ERROR, + "Found newline in value for %s; " "not returning it", var); os_free(ret); ret = NULL; |