]> arthur.barton.de Git - netatalk.git/commitdiff
bugfixes: last byte was overwritten with 0x0 in convert_string, increase inbuf on...
authorbfernhomberg <bfernhomberg>
Fri, 12 Sep 2003 19:46:37 +0000 (19:46 +0000)
committerbfernhomberg <bfernhomberg>
Fri, 12 Sep 2003 19:46:37 +0000 (19:46 +0000)
libatalk/unicode/charcnv.c

index 9b9a8d32f47631c52c211b7ec883a632c118a3bc..fe1f42b1d6a9c23310311923368b9afe4e51b9e1 100644 (file)
@@ -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;