]> git.ipfire.org Git - thirdparty/curl.git/commit
curl_multibyte: Remove local encoding fallbacks
authorJay Satiro <raysatiro@yahoo.com>
Tue, 15 Jun 2021 04:13:36 +0000 (00:13 -0400)
committerJay Satiro <raysatiro@yahoo.com>
Mon, 21 Jun 2021 05:57:16 +0000 (01:57 -0400)
commit765e060796d5f88550bf4e7610fb0c7a7eca7f39
treeb4d5cc8bc35d0c38ac37613cb8b53a43d0f2c42b
parent4331c6dcebb30eb811b8075c3e523e4471024d4f
curl_multibyte: Remove local encoding fallbacks

- If the UTF-8 to UTF-16 conversion fails in Windows Unicode builds then
  no longer fall back to assuming the string is in a local encoding.

Background:

Some functions in Windows Unicode builds must convert UTF-8 to UTF-16 to
pass to the Windows CRT API wide-character functions since in Windows
UTF-8 is not a valid locale (or at least 99% of the time right now).

Prior to this change if the Unicode encoding conversion failed then
libcurl would assume, for backwards compatibility with applications that
may have written their code for non-Unicode builds, attempt to convert
the string from local encoding to UTF-16.

That type of "best effort" could theoretically cause some type of
security or other problem if a string that was locally encoded was also
valid UTF-8, and therefore an unexpected UTF-8 to UTF-16 conversion
could occur.

Ref: https://github.com/curl/curl/pull/7246

Closes https://github.com/curl/curl/pull/7257
lib/curl_multibyte.c