mirror of
https://github.com/samba-team/samba.git
synced 2025-01-26 10:04:02 +03:00
lib/util/charset Fix string termination conditions for UTF16 strings
This punts partial UTF16 strings to iconv() to deal with, as it's not a fast path any longer if it's got an odd length. Andrew Bartlett Signed-off-by: Andrew Tridgell <tridge@samba.org>
This commit is contained in:
parent
240465f96e
commit
75d5ba4109
@ -179,8 +179,8 @@ bool convert_string_error_handle(struct smb_iconv_handle *ic,
|
||||
unsigned char lastp = '\0';
|
||||
|
||||
/* If all characters are ascii, fast path here. */
|
||||
while (((slen == (size_t)-1) || (slen >= 2)) && dlen) {
|
||||
if (((lastp = *p) <= 0x7f) && (p[1] == 0)) {
|
||||
while (((slen == (size_t)-1) || (slen >= 1)) && dlen) {
|
||||
if (slen >= 2 && ((lastp = *p) <= 0x7f) && (p[1] == 0)) {
|
||||
*q++ = *p;
|
||||
if (slen != (size_t)-1) {
|
||||
slen -= 2;
|
||||
@ -221,8 +221,8 @@ bool convert_string_error_handle(struct smb_iconv_handle *ic,
|
||||
unsigned char lastp = '\0';
|
||||
|
||||
/* If all characters are ascii, fast path here. */
|
||||
while (slen && (dlen >= 2)) {
|
||||
if ((lastp = *p) <= 0x7F) {
|
||||
while (slen && (dlen >= 1)) {
|
||||
if (dlen >=2 && (lastp = *p) <= 0x7F) {
|
||||
*q++ = *p++;
|
||||
*q++ = '\0';
|
||||
if (slen != (size_t)-1) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user