aboutsummaryrefslogtreecommitdiffstats
path: root/wpa_supplicant
diff options
context:
space:
mode:
authorPaul Stewart <pstew@google.com>2016-03-03 23:40:19 (GMT)
committerJouni Malinen <j@w1.fi>2016-05-02 08:08:25 (GMT)
commit0fe5a234240a108b294a87174ad197f6b5cb38e9 (patch)
treea9ed54e2fded864a37fa8afc380e8dbc8b824ffe /wpa_supplicant
parent5594df44c7cda554ab9d8bc8d8914fd5639a1c95 (diff)
downloadhostap-0fe5a234240a108b294a87174ad197f6b5cb38e9.zip
hostap-0fe5a234240a108b294a87174ad197f6b5cb38e9.tar.gz
hostap-0fe5a234240a108b294a87174ad197f6b5cb38e9.tar.bz2
Remove newlines from wpa_supplicant config network output
Spurious newlines output while writing the config file can corrupt the wpa_supplicant configuration. Avoid writing these for the network block parameters. This is a generic filter that cover cases that may not have been explicitly addressed with a more specific commit to avoid control characters in the psk parameter. Signed-off-by: Paul Stewart <pstew@google.com>
Diffstat (limited to 'wpa_supplicant')
-rw-r--r--wpa_supplicant/config.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/wpa_supplicant/config.c b/wpa_supplicant/config.c
index fdd9643..eb97cd5 100644
--- a/wpa_supplicant/config.c
+++ b/wpa_supplicant/config.c
@@ -2699,8 +2699,19 @@ 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 (ret && has_newline(ret)) {
+ wpa_printf(MSG_ERROR,
+ "Found newline in value for %s; not returning it",
+ var);
+ os_free(ret);
+ ret = NULL;
+ }
+
+ return ret;
+ }
}
return NULL;