Fix #321 was not correctly implemented

While #321 prevented a core dump, that fix still caused memory corruption.

src/coap_gnutls.c:

Correct the code to correctly NULL terminate the created username.
This commit is contained in:
Jon Shallow committed 2019-04-07 17:48:46 +01:00
1 parent af1d602486
commit a106ecc319
1 file changed
+1 -1
+1 -1
View File
@@ -404,7 +404,7 @@ psk_client_callback(gnutls_session_t g_session,
*username = gnutls_malloc(identity_len+1);
if (*username) {
memcpy(*username, identity, identity_len);
username[identity_len] = '\0';
(*username)[identity_len] = '\0';
}
key->data = gnutls_malloc(psk_len);