aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPaul Stewart <pstew@google.com>2016-03-03 15:40:19 -0800
committerAdrian DC <radian.dc@gmail.com>2016-12-04 02:18:52 +0100
commit6a6c811042a9e5e11f92eb2f0194febe3f480128 (patch)
treea10cfe90c813fea4f55682d918759aa5e2c54aab /src
parent7f55f0967b0ec40de34e0aa1d3f3c6f2a2976d49 (diff)
downloadandroid_external_wpa_supplicant_8-stable/cm-13.0-ZNH5Y.tar.gz
android_external_wpa_supplicant_8-stable/cm-13.0-ZNH5Y.tar.bz2
android_external_wpa_supplicant_8-stable/cm-13.0-ZNH5Y.zip
Remove newlines from wpa_supplicant config network outputstable/cm-13.0-ZNH5Y
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. RM-290 Signed-off-by: Paul Stewart <pstew@google.com> Git-commit: 0fe5a234240a108b294a87174ad197f6b5cb38e9 Git-repo: git://w1.fi/srv/git/hostap.git Change-Id: I35e8483bdda5c391b95da42c2f577d5e9217f2e2 CRs-fixed: 1007548
Diffstat (limited to 'src')
-rw-r--r--src/utils/common.c11
-rw-r--r--src/utils/common.h1
2 files changed, 12 insertions, 0 deletions
diff --git a/src/utils/common.c b/src/utils/common.c
index 3659b7d8..e77b7db5 100644
--- a/src/utils/common.c
+++ b/src/utils/common.c
@@ -709,6 +709,17 @@ int has_ctrl_char(const u8 *data, size_t len)
}
+int has_newline(const char *str)
+{
+ while (*str) {
+ if (*str == '\n' || *str == '\r')
+ return 1;
+ str++;
+ }
+ return 0;
+}
+
+
size_t merge_byte_arrays(u8 *res, size_t res_len,
const u8 *src1, size_t src1_len,
const u8 *src2, size_t src2_len)
diff --git a/src/utils/common.h b/src/utils/common.h
index 667048b6..7dbb24a6 100644
--- a/src/utils/common.h
+++ b/src/utils/common.h
@@ -504,6 +504,7 @@ const char * wpa_ssid_txt(const u8 *ssid, size_t ssid_len);
char * wpa_config_parse_string(const char *value, size_t *len);
int is_hex(const u8 *data, size_t len);
int has_ctrl_char(const u8 *data, size_t len);
+int has_newline(const char *str);
size_t merge_byte_arrays(u8 *res, size_t res_len,
const u8 *src1, size_t src1_len,
const u8 *src2, size_t src2_len);