diff options
author | Paul Stewart <pstew@google.com> | 2016-03-03 15:33:47 -0800 |
---|---|---|
committer | Jessica Wagantall <jwagantall@cyngn.com> | 2016-05-09 12:37:08 -0700 |
commit | 6471d1398a7987f6574ce25f41344bb4564e08bc (patch) | |
tree | ddb489c7b6b2fd467d7dd94bc6befd53eca669a3 | |
parent | 572fb31cb85dc82286e26e7ceb2bca117a4bf6f4 (diff) | |
download | android_external_wpa_supplicant_8-6471d1398a7987f6574ce25f41344bb4564e08bc.tar.gz android_external_wpa_supplicant_8-6471d1398a7987f6574ce25f41344bb4564e08bc.tar.bz2 android_external_wpa_supplicant_8-6471d1398a7987f6574ce25f41344bb4564e08bc.zip |
Remove newlines from config output
Spurious newlines output while writing the config file can
corrupt the wpa_supplicant configuration. Avoid writing these.
Ticket: CYNGNOS-2373
Bug: 27371366
Change-Id: I3bb99b8c46dba1c81cbccc76ed0cd01abc3ccef9
-rw-r--r-- | wpa_supplicant/config.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/wpa_supplicant/config.c b/wpa_supplicant/config.c index 93c7e5e1..976e61c4 100644 --- a/wpa_supplicant/config.c +++ b/wpa_supplicant/config.c @@ -2369,8 +2369,16 @@ char * wpa_config_get(struct wpa_ssid *ssid, const char *var) for (i = 0; i < NUM_SSID_FIELDS; i++) { const struct parse_data *field = &ssid_fields[i]; - if (os_strcmp(var, field->name) == 0) - return field->writer(field, ssid); + 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; " + "not returning it", var); + os_free(ret); + ret = NULL; + } + return ret; + } } return NULL; |