From: Nikos Mavrogiannopoulos Date: Fri, 26 Aug 2016 13:56:19 +0000 (+0200) Subject: _gnutls_ucs2_to_utf8: fixed null termination check in windows code X-Git-Tag: gnutls_3_5_4~16 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=a80a0f727c705823239b043c82dec9bc41deef3d;p=thirdparty%2Fgnutls.git _gnutls_ucs2_to_utf8: fixed null termination check in windows code --- diff --git a/lib/system/iconv.c b/lib/system/iconv.c index b06a6db346..fa7f72e27a 100644 --- a/lib/system/iconv.c +++ b/lib/system/iconv.c @@ -56,7 +56,7 @@ int _gnutls_ucs2_to_utf8(const void *data, size_t size, checked = 1; } - if (((uint8_t *) data)[size] == 0 && ((uint8_t *) data)[size+1] == 0) { + if (size > 2 && ((uint8_t *) data)[size-1] == 0 && ((uint8_t *) data)[size-2] == 0) { size -= 2; }