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:33:03 -0700 |
| commit | 066cf157312a2c9cc175cd915ed8297e00ad420e (patch) | |
| tree | e4798dc8de3662c209c519ebb3e54f94ca2d3e20 | |
| parent | c42dabc2253f2648e8dc26513073be8aed96aee0 (diff) | |
| download | android_external_wpa_supplicant_8-066cf157312a2c9cc175cd915ed8297e00ad420e.tar.gz android_external_wpa_supplicant_8-066cf157312a2c9cc175cd915ed8297e00ad420e.tar.bz2 android_external_wpa_supplicant_8-066cf157312a2c9cc175cd915ed8297e00ad420e.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; |
