From d7a86bafc38dca22f189a923f95d1be34d4a38bd Mon Sep 17 00:00:00 2001 From: bfernhomberg Date: Fri, 12 Sep 2003 19:46:37 +0000 Subject: [PATCH] bugfixes: last byte was overwritten with 0x0 in convert_string, increase inbuf on cap_encode --- libatalk/unicode/charcnv.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/libatalk/unicode/charcnv.c b/libatalk/unicode/charcnv.c index 9b9a8d32..fe1f42b1 100644 --- a/libatalk/unicode/charcnv.c +++ b/libatalk/unicode/charcnv.c @@ -282,11 +282,11 @@ static size_t convert_string_internal(charset_t from, charset_t to, /* Terminate the string */ if (to == CH_UCS2 && destlen-o_len >= 2) { - *outbuf++ = 0; - *outbuf++ = 0; + *(++outbuf) = 0; + *(++outbuf) = 0; } else if ( destlen-o_len > 0) - *outbuf++ = 0; + *(++outbuf) = 0; return destlen-o_len; } @@ -419,12 +419,12 @@ convert: /* Terminate the string */ if (to == CH_UCS2 && destlen-o_len >= 2) { - *outbuf++ = 0; - *outbuf++ = 0; + *(++outbuf) = 0; + *outbuf = 0; *dest = (char *)realloc(ob,destlen+2); } else if ( destlen-o_len > 0) { - *outbuf++ = 0; + *(++outbuf) = 0; *dest = (char *)realloc(ob,destlen+1); } @@ -935,6 +935,7 @@ conversion_loop: SAFE_FREE(buf_save); buflen = 0; i_len -= 2; + inbuf += 2; if (flags) *flags |= CONV_REQESCAPE; if ( i_len > 0) goto conversion_loop; -- 2.39.2