diff options
author | seanbright <seanbright@f38db490-d61c-443f-a65b-d21fe96a405b> | 2008-10-26 20:27:42 +0000 |
---|---|---|
committer | seanbright <seanbright@f38db490-d61c-443f-a65b-d21fe96a405b> | 2008-10-26 20:27:42 +0000 |
commit | 2fa284e63d327bc51647735d808543a99fbb8d57 (patch) | |
tree | 28aabdaff8f008f0b0912bb679ce8b4e5ec5e948 /funcs | |
parent | 1cc0672aef2db07efe7ed2eb28f2502463c6cbdc (diff) |
Merged revisions 152060 via svnmerge from
https://origsvn.digium.com/svn/asterisk/trunk
................
r152060 | seanbright | 2008-10-26 16:25:08 -0400 (Sun, 26 Oct 2008) | 15 lines
Merged revisions 152059 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4
........
r152059 | seanbright | 2008-10-26 16:23:36 -0400 (Sun, 26 Oct 2008) | 7 lines
Since passing \0 as the second argument to strchr is valid (and will
match the trailing \0 of a string) we need to check that first, otherwise
we end up with incorrect results. Fix suggested by reporter.
(closes issue #13787)
Reported by: meitinger
........
................
git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.6.1@152068 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'funcs')
-rw-r--r-- | funcs/func_strings.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/funcs/func_strings.c b/funcs/func_strings.c index b8aac1351..39dd86666 100644 --- a/funcs/func_strings.c +++ b/funcs/func_strings.c @@ -778,7 +778,10 @@ static int keypadhash(struct ast_channel *chan, const char *cmd, char *data, cha char *bufptr, *dataptr; for (bufptr = buf, dataptr = data; bufptr < buf + buflen - 1; dataptr++) { - if (*dataptr == '1') { + if (*dataptr == '\0') { + *bufptr++ = '\0'; + break; + } else if (*dataptr == '1') { *bufptr++ = '1'; } else if (strchr("AaBbCc2", *dataptr)) { *bufptr++ = '2'; @@ -798,9 +801,6 @@ static int keypadhash(struct ast_channel *chan, const char *cmd, char *data, cha *bufptr++ = '9'; } else if (*dataptr == '0') { *bufptr++ = '0'; - } else if (*dataptr == '\0') { - *bufptr++ = '\0'; - break; } } buf[buflen - 1] = '\0'; |