Commit 163d22e1 authored by Paul Stewart's avatar Paul Stewart Committed by The Android Automerger
Browse files

Guard against return value already being null

If there is no retrieved parameter, we should not de-reference null

Bug: 27748546
Change-Id: I8e6ceba26ab7d73ab365b72c0bfdcdb0a36a59a7
parent 7b90d949
......@@ -2371,8 +2371,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;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment