aboutsummaryrefslogtreecommitdiffstats
path: root/main
diff options
context:
space:
mode:
authorseanbright <seanbright@f38db490-d61c-443f-a65b-d21fe96a405b>2011-01-19 19:03:32 +0000
committerseanbright <seanbright@f38db490-d61c-443f-a65b-d21fe96a405b>2011-01-19 19:03:32 +0000
commit5a0d3d7d394cbb3aad5870337ab7a2b87a78f960 (patch)
treeb42a2d3c113dadeb3800099b2751e68373270d7e /main
parent692731d8aa231330fb87ccc06f2433fe85f46f7a (diff)
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) ........ git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.8@302555 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'main')
-rw-r--r--main/utils.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/main/utils.c b/main/utils.c
index 2f7086a0d..ad03044e7 100644
--- a/main/utils.c
+++ b/main/utils.c
@@ -422,7 +422,7 @@ void ast_uri_decode(char *s)
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 */