summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNikos Mavrogiannopoulos <nmav@gnutls.org>2016-05-10 22:46:34 +0200
committerNikos Mavrogiannopoulos <nmav@gnutls.org>2016-05-10 22:55:59 +0200
commit2e0fc54bb13829c54032ad763e0b38638d390d10 (patch)
treee12c99e0628af467c51e7150ba548a62b4ba96c2
parentdefd71113fc6b0a575c599df93b957a1e4458f80 (diff)
downloadgnutls-2e0fc54bb13829c54032ad763e0b38638d390d10.tar.gz
pack_srp_auth_info: corrected check for uninitialized username
-rw-r--r--lib/session_pack.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/session_pack.c b/lib/session_pack.c
index e49b32c54f..96b8efe0c1 100644
--- a/lib/session_pack.c
+++ b/lib/session_pack.c
@@ -421,7 +421,7 @@ pack_srp_auth_info(gnutls_session_t session, gnutls_buffer_st * ps)
size_t cur_size;
const char *username = NULL;
- if (info && info->username) {
+ if (info) {
username = info->username;
len = strlen(info->username) + 1; /* include the terminating null */
} else
@@ -652,6 +652,8 @@ unpack_psk_auth_info(gnutls_session_t session, gnutls_buffer_st * ps)
}
BUFFER_POP(ps, info->username, username_size);
+ if (username_size == 0)
+ info->username[0] = 0;
BUFFER_POP_NUM(ps, hint_size);
if (hint_size > sizeof(info->hint)) {
@@ -659,6 +661,8 @@ unpack_psk_auth_info(gnutls_session_t session, gnutls_buffer_st * ps)
return GNUTLS_E_INTERNAL_ERROR;
}
BUFFER_POP(ps, info->hint, hint_size);
+ if (hint_size == 0)
+ info->hint[0] = 0;
BUFFER_POP_NUM(ps, info->dh.secret_bits);