[gnutls-devel] GnuTLS | Fix coverity in lib/ (!1092)
Development of GNU's TLS library
gnutls-devel at lists.gnutls.org
Thu Oct 10 18:01:09 CEST 2019
Nikos Mavrogiannopoulos started a new discussion on lib/str.c: https://gitlab.com/gnutls/gnutls/merge_requests/1092#note_228905953
>
> 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);
LGTM, but this function is not tested in our test suite so it makes me uneasy changing it. An simple way would be to export and introduce a unit test for the unescape function, or to modify `tpmtool_test.sh` to include escaped files.
--
Reply to this email directly or view it on GitLab: https://gitlab.com/gnutls/gnutls/merge_requests/1092#note_228905953
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/20191010/db7ff426/attachment.html>
More information about the Gnutls-devel
mailing list