diff options
| author | Paul Stewart <pstew@google.com> | 2016-03-18 18:14:26 -0700 |
|---|---|---|
| committer | Jessica Wagantall <jwagantall@cyngn.com> | 2016-05-03 12:33:35 -0700 |
| commit | 94e724be6f6737816c89d34f8b012f547a74e466 (patch) | |
| tree | 226f478c75e69dd01bfca38b53622263c931c70d | |
| parent | 5b21aa1f70d40ceb101974c42122b78632829f1c (diff) | |
| download | android_external_wpa_supplicant_8-stable/cm-13.0-ZNH2K.tar.gz android_external_wpa_supplicant_8-stable/cm-13.0-ZNH2K.tar.bz2 android_external_wpa_supplicant_8-stable/cm-13.0-ZNH2K.zip | |
Guard against return value already being nullstable/cm-13.0-ZNH2KBstable/cm-13.0-ZNH2K
If there is no retrieved parameter, we should not de-reference null
Ticket: CYNGNOS-2373
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 653d9dc6..ee69ab08 100644 --- a/wpa_supplicant/config.c +++ b/wpa_supplicant/config.c @@ -2606,8 +2606,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; |
