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

Development of GNU's TLS library gnutls-devel at lists.gnutls.org
Mon May 27 14:29:25 CEST 2019




Nikos Mavrogiannopoulos commented on a discussion on lib/ext/pre_shared_key.c: https://gitlab.com/gnutls/gnutls/merge_requests/917#note_174852416

>  		} 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);

Wouldn't then a cast to `char *` be sufficient? The const seems unnecessary

-- 
Reply to this email directly or view it on GitLab: https://gitlab.com/gnutls/gnutls/merge_requests/917#note_174852416
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/20190527/eef5ea9f/attachment.html>


More information about the Gnutls-devel mailing list