[asterisk-commits] tilghman: branch 1.4 r298480 - /branches/1.4/res/res_config_odbc.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu Dec 16 09:03:48 UTC 2010


Author: tilghman
Date: Thu Dec 16 03:03:40 2010
New Revision: 298480

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=298480
Log:
Only increment the pointer once per loop, otherwise we corrupt the value.

(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

Modified:
    branches/1.4/res/res_config_odbc.c

Modified: branches/1.4/res/res_config_odbc.c
URL: http://svnview.digium.com/svn/asterisk/branches/1.4/res/res_config_odbc.c?view=diff&rev=298480&r1=298479&r2=298480
==============================================================================
--- branches/1.4/res/res_config_odbc.c (original)
+++ branches/1.4/res/res_config_odbc.c Thu Dec 16 03:03:40 2010
@@ -67,7 +67,7 @@
 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 @@
 					/* 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)) {




More information about the asterisk-commits mailing list