[gnutls-devel] GnuTLS | support non-NULL-terminated PSKs (!917)

Development of GNU's TLS library gnutls-devel at lists.gnutls.org
Fri May 24 20:01:13 CEST 2019




Ander Juaristi commented on a discussion on lib/ext/pre_shared_key.c: https://gitlab.com/gnutls/gnutls/merge_requests/917#note_174340914

>  		} else if (pskcred &&
>  			   psk.ob_ticket_age == 0 &&
>  			   psk.identity.size > 0 && psk.identity.size <= MAX_USERNAME_SIZE) {
> -			/* _gnutls_psk_pwd_find_entry() expects 0-terminated identities */
> -			char identity_str[MAX_USERNAME_SIZE + 1];
> -
>  			prf = pskcred->binder_algo;
>  
> -			memcpy(identity_str, psk.identity.data, psk.identity.size);
> -			identity_str[psk.identity.size] = 0;
> -
>  			/* this fails only on configuration errors; as such we always
>  			 * return its error code in that case */
> -			ret = _gnutls_psk_pwd_find_entry(session, identity_str, &key);
> +			ret = _gnutls_psk_pwd_find_entry(session, (const char *) psk.identity.data, psk.identity.size, &key);

Yes, because data is an `unsigned char *`.

-- 
Reply to this email directly or view it on GitLab: https://gitlab.com/gnutls/gnutls/merge_requests/917#note_174340914
You're receiving this email because of your account on gitlab.com.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.gnupg.org/pipermail/gnutls-devel/attachments/20190524/e6385185/attachment-0001.html>


More information about the Gnutls-devel mailing list