]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
Only increment the pointer once per loop, otherwise we corrupt the value.
authorTilghman Lesher <tilghman@meg.abyt.es>
Thu, 16 Dec 2010 09:03:40 +0000 (09:03 +0000)
committerTilghman Lesher <tilghman@meg.abyt.es>
Thu, 16 Dec 2010 09:03:40 +0000 (09:03 +0000)
(closes issue #18251)
 Reported by: bcnit
 Patches:
       20101110__issue18251.diff.txt uploaded by tilghman (license 14)
 Tested by: trev, jthurman, elguero

(closes issue #18279)
 Reported by: zerohalo
 Patches:
       20101109__issue18279.diff.txt uploaded by tilghman (license 14)
 Tested by: zerohalo

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@298480 65c4cc65-6c06-0410-ace0-fbb531ad65f3

res/res_config_odbc.c

index daed738d2fc93bb0b6303703caf6ca82a8d30394..52913507d4e1d3ad4c97f561724ecbf4bc009f4e 100644 (file)
@@ -67,7 +67,7 @@ struct custom_prepare_struct {
 static void decode_chunk(char *chunk)
 {
        for (; *chunk; chunk++) {
-               if (*chunk == '^' && strchr("0123456789ABCDEFabcdef", chunk[1]) && strchr("0123456789ABCDEFabcdef", chunk[2])) {
+               if (*chunk == '^' && strchr("0123456789ABCDEF", chunk[1]) && strchr("0123456789ABCDEF", chunk[2])) {
                        sscanf(chunk + 1, "%02hhX", chunk);
                        memmove(chunk + 1, chunk + 3, strlen(chunk + 3) + 1);
                }
@@ -108,9 +108,8 @@ static SQLHSTMT custom_prepare(struct odbc_obj *obj, void *data)
                                        /* We use ^XX, instead of %XX because '%' is a special character in SQL */
                                        snprintf(eptr, encodebuf + sizeof(encodebuf) - eptr, "^%02hhX", *vptr);
                                        eptr += 3;
-                                       vptr++;
                                } else {
-                                       *eptr++ = *vptr++;
+                                       *eptr++ = *vptr;
                                }
                        }
                        if (eptr < encodebuf + sizeof(encodebuf)) {