[gnutls-devel] GnuTLS | Fix coverity in lib/ (!1092)
Development of GNU's TLS library
gnutls-devel at lists.gnutls.org
Sat Oct 12 23:13:30 CEST 2019
Nikos Mavrogiannopoulos commented on a discussion on lib/str.c: https://gitlab.com/gnutls/gnutls/merge_requests/1092#note_229671343
>
> while (pos < dest->length) {
> if (dest->data[pos] == '%') {
> - char b[3];
> - unsigned int u;
> unsigned char x;
>
> - b[0] = dest->data[pos + 1];
> - b[1] = dest->data[pos + 2];
> - b[2] = 0;
> -
> - sscanf(b, "%02x", &u);
> -
> - x = u;
> + hex_decode((char *) dest->data + pos + 1, 2, &x, 1);
I would not spend much time on improving `_gnutls_buffer_unescape`. It is used on very corner case and improving it will not really improve performance in any noticeable way. I also see limitations of an `append_unescape()` function (e.g., would it work when you append byte by byte?, and other corner cases).
--
Reply to this email directly or view it on GitLab: https://gitlab.com/gnutls/gnutls/merge_requests/1092#note_229671343
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/20191012/cd1a9b40/attachment-0001.html>
More information about the Gnutls-devel
mailing list