diff options
author | Nikos Mavrogiannopoulos <nmav@redhat.com> | 2016-09-07 08:45:24 +0200 |
---|---|---|
committer | Nikos Mavrogiannopoulos <nmav@redhat.com> | 2016-09-07 08:45:24 +0200 |
commit | dfcc4443d297548a203c7ff98ea8b6b6cc1a3c53 (patch) | |
tree | cde53f7d1b3077f8ea96f1361ab7ed2be7628476 /lib/system | |
parent | 34a9bfb7c4e2db99c7c78dd9250eeb5118639849 (diff) | |
download | gnutls-dfcc4443d297548a203c7ff98ea8b6b6cc1a3c53.tar.gz |
_gnutls_ucs2_to_utf8: corrected use of WideCharToMultiByte in windows
Diffstat (limited to 'lib/system')
-rw-r--r-- | lib/system/iconv.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/system/iconv.c b/lib/system/iconv.c index fa7f72e27a..d89ca05df2 100644 --- a/lib/system/iconv.c +++ b/lib/system/iconv.c @@ -60,8 +60,6 @@ int _gnutls_ucs2_to_utf8(const void *data, size_t size, size -= 2; } - src_len = wcslen(data); - src = gnutls_malloc(size+2); if (src == NULL) return gnutls_assert_val(GNUTLS_E_MEMORY_ERROR); @@ -75,9 +73,12 @@ int _gnutls_ucs2_to_utf8(const void *data, size_t size, } else { memcpy(src, data, size); } + src[size] = 0; src[size+1] = 0; + src_len = wcslen((void*)src); + ret = WideCharToMultiByte(CP_UTF8, flags, (void *) src, src_len, NULL, 0, |