[asterisk-commits] seanbright: branch 1.8 r302555 - in /branches/1.8: ./ main/utils.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Wed Jan 19 13:03:36 CST 2011


Author: seanbright
Date: Wed Jan 19 13:03:32 2011
New Revision: 302555

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=302555
Log:
Merged revisions 302554 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/1.6.2

........
  r302554 | seanbright | 2011-01-19 14:02:29 -0500 (Wed, 19 Jan 2011) | 7 lines
  
  Don't call strlen() when we only need to look at the next character or two.
  
  (closes issue #18042)
  Reported by: wdoekes
  Patches:
        astsvn-inefficient-ast-uri-decode.patch uploaded by wdoekes (license 717)
........

Modified:
    branches/1.8/   (props changed)
    branches/1.8/main/utils.c

Propchange: branches/1.8/
------------------------------------------------------------------------------
Binary property 'branch-1.6.2-merged' - no diff available.

Modified: branches/1.8/main/utils.c
URL: http://svnview.digium.com/svn/asterisk/branches/1.8/main/utils.c?view=diff&rev=302555&r1=302554&r2=302555
==============================================================================
--- branches/1.8/main/utils.c (original)
+++ branches/1.8/main/utils.c Wed Jan 19 13:03:32 2011
@@ -422,7 +422,7 @@
 	unsigned int tmp;
 
 	for (o = s; *s; s++, o++) {
-		if (*s == '%' && strlen(s) > 2 && sscanf(s + 1, "%2x", &tmp) == 1) {
+		if (*s == '%' && s[1] != '\0' && s[2] != '\0' && sscanf(s + 1, "%2x", &tmp) == 1) {
 			/* have '%', two chars and correct parsing */
 			*o = tmp;
 			s += 2;	/* Will be incremented once more when we break out */




More information about the asterisk-commits mailing list