diff options
author | Sean Bright <sean@malleable.com> | 2011-01-19 19:04:25 +0000 |
---|---|---|
committer | Sean Bright <sean@malleable.com> | 2011-01-19 19:04:25 +0000 |
commit | 5943a34463fd89328181a2bf747551165b152287 (patch) | |
tree | e605ed2a59b84a2341b1ba878c23479b28f40a19 | |
parent | f4d63bf918928516db3694c7120edea51b99047e (diff) |
Merged revisions 302555 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.8
................
r302555 | seanbright | 2011-01-19 14:03:32 -0500 (Wed, 19 Jan 2011) | 14 lines
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: https://origsvn.digium.com/svn/asterisk/trunk@302556 65c4cc65-6c06-0410-ace0-fbb531ad65f3
-rw-r--r-- | main/utils.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/main/utils.c b/main/utils.c index dd0c3187a..84f478826 100644 --- a/main/utils.c +++ b/main/utils.c @@ -429,7 +429,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 */ |