aboutsummaryrefslogtreecommitdiffstats
path: root/src/eap_server
diff options
context:
space:
mode:
authorJouni Malinen <jouni@qca.qualcomm.com>2014-06-02 12:50:31 (GMT)
committerJouni Malinen <j@w1.fi>2014-06-02 14:36:51 (GMT)
commit95f6f6a49d44a2fc23e425482455cd170ee8255a (patch)
tree3cc9ef72475687f1bb7df21a5d42e068027c0d52 /src/eap_server
parentee54e4010e57c68422d1db8d7388dcf001d3db7d (diff)
downloadhostap-95f6f6a49d44a2fc23e425482455cd170ee8255a.zip
hostap-95f6f6a49d44a2fc23e425482455cd170ee8255a.tar.gz
hostap-95f6f6a49d44a2fc23e425482455cd170ee8255a.tar.bz2
RADIUS/EAP server: Use longer username buffer to avoid truncation
If the peer provides a username with large part of it being non-ASCII characters, the previously used buffers may not have been long enough to include the full string in debug logs and database search due to forced truncation of the string by printf_encode(). Avoid this by increasing the buffer sizes to fit in the maximum result. Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
Diffstat (limited to 'src/eap_server')
-rw-r--r--src/eap_server/eap_server_identity.c4
-rw-r--r--src/eap_server/eap_server_mschapv2.c4
-rw-r--r--src/eap_server/eap_server_ttls.c4
3 files changed, 6 insertions, 6 deletions
diff --git a/src/eap_server/eap_server_identity.c b/src/eap_server/eap_server_identity.c
index b3c2087..4501533 100644
--- a/src/eap_server/eap_server_identity.c
+++ b/src/eap_server/eap_server_identity.c
@@ -120,9 +120,9 @@ static void eap_identity_process(struct eap_sm *sm, void *priv,
return; /* Should not happen - frame already validated */
wpa_hexdump_ascii(MSG_DEBUG, "EAP-Identity: Peer identity", pos, len);
- buf = os_malloc(len * 3 + 1);
+ buf = os_malloc(len * 4 + 1);
if (buf) {
- printf_encode(buf, len * 3 + 1, pos, len);
+ printf_encode(buf, len * 4 + 1, pos, len);
eap_log_msg(sm, "EAP-Response/Identity '%s'", buf);
os_free(buf);
}
diff --git a/src/eap_server/eap_server_mschapv2.c b/src/eap_server/eap_server_mschapv2.c
index 790c719..0eb7908 100644
--- a/src/eap_server/eap_server_mschapv2.c
+++ b/src/eap_server/eap_server_mschapv2.c
@@ -330,9 +330,9 @@ static void eap_mschapv2_process_response(struct eap_sm *sm,
wpa_printf(MSG_MSGDUMP, "EAP-MSCHAPV2: Flags 0x%x", flags);
wpa_hexdump_ascii(MSG_MSGDUMP, "EAP-MSCHAPV2: Name", name, name_len);
- buf = os_malloc(name_len * 3 + 1);
+ buf = os_malloc(name_len * 4 + 1);
if (buf) {
- printf_encode(buf, name_len * 3 + 1, name, name_len);
+ printf_encode(buf, name_len * 4 + 1, name, name_len);
eap_log_msg(sm, "EAP-MSCHAPV2 Name '%s'", buf);
os_free(buf);
}
diff --git a/src/eap_server/eap_server_ttls.c b/src/eap_server/eap_server_ttls.c
index 24225a4..d09a769 100644
--- a/src/eap_server/eap_server_ttls.c
+++ b/src/eap_server/eap_server_ttls.c
@@ -985,9 +985,9 @@ static void eap_ttls_process_phase2(struct eap_sm *sm,
if (parse.user_name) {
char *nbuf;
- nbuf = os_malloc(parse.user_name_len * 3 + 1);
+ nbuf = os_malloc(parse.user_name_len * 4 + 1);
if (nbuf) {
- printf_encode(nbuf, parse.user_name_len * 3 + 1,
+ printf_encode(nbuf, parse.user_name_len * 4 + 1,
parse.user_name,
parse.user_name_len);
eap_log_msg(sm, "TTLS-User-Name '%s'", nbuf);