aboutsummaryrefslogtreecommitdiffstats
path: root/wpa_supplicant
diff options
context:
space:
mode:
authorJouni Malinen <jouni@qca.qualcomm.com>2016-12-05 13:36:56 (GMT)
committerJouni Malinen <j@w1.fi>2016-12-05 13:36:56 (GMT)
commit5ec3d510e119c919c4138b407df8914b6706c5cd (patch)
tree38d33574bf39c5f03eb8ea15180da4594d764259 /wpa_supplicant
parentd1ea80361b0d4fa4beda6f3c2fbd335fef59b42d (diff)
downloadhostap-5ec3d510e119c919c4138b407df8914b6706c5cd.zip
hostap-5ec3d510e119c919c4138b407df8914b6706c5cd.tar.gz
hostap-5ec3d510e119c919c4138b407df8914b6706c5cd.tar.bz2
wpa_passphrase: Reject invalid passphrase
Reject a passphrase with control characters instead of trying to write out an example network configuration block with such control characters included. Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
Diffstat (limited to 'wpa_supplicant')
-rw-r--r--wpa_supplicant/wpa_passphrase.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/wpa_supplicant/wpa_passphrase.c b/wpa_supplicant/wpa_passphrase.c
index 9b568f0..adca1cc 100644
--- a/wpa_supplicant/wpa_passphrase.c
+++ b/wpa_supplicant/wpa_passphrase.c
@@ -17,6 +17,7 @@ int main(int argc, char *argv[])
unsigned char psk[32];
int i;
char *ssid, *passphrase, buf[64], *pos;
+ size_t len;
if (argc < 2) {
printf("usage: wpa_passphrase <ssid> [passphrase]\n"
@@ -47,10 +48,15 @@ int main(int argc, char *argv[])
passphrase = buf;
}
- if (os_strlen(passphrase) < 8 || os_strlen(passphrase) > 63) {
+ len = os_strlen(passphrase);
+ if (len < 8 || len > 63) {
printf("Passphrase must be 8..63 characters\n");
return 1;
}
+ if (has_ctrl_char((u8 *) passphrase, len)) {
+ printf("Invalid passphrase character\n");
+ return 1;
+ }
pbkdf2_sha1(passphrase, (u8 *) ssid, os_strlen(ssid), 4096, psk, 32);