Merged revisions 106552 via svnmerge from

https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r106552 | tilghman | 2008-03-07 00:36:33 -0600 (Fri, 07 Mar 2008) | 6 lines

Safely use the strncat() function.
(closes issue #11958)
 Reported by: norman
 Patches: 
       20080209__bug11958.diff.txt uploaded by Corydon76 (license 14)

........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@106553 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
Tilghman Lesher
2008-03-07 06:54:47 +00:00
parent 5fa773a9f9
commit 8718878490
13 changed files with 28 additions and 26 deletions

View File

@@ -322,7 +322,7 @@ static int hashkeys_read(struct ast_channel *chan, const char *cmd, char *data,
AST_LIST_TRAVERSE(&chan->varshead, newvar, entries) {
if (strncasecmp(prefix, ast_var_name(newvar), plen) == 0) {
/* Copy everything after the prefix */
strncat(buf, ast_var_name(newvar) + plen, len);
strncat(buf, ast_var_name(newvar) + plen, len - strlen(buf) - 1);
/* Trim the trailing ~ */
buf[strlen(buf) - 1] = ',';
}
@@ -387,8 +387,8 @@ static int hash_read(struct ast_channel *chan, const char *cmd, char *data, char
for (i = 0; i < arg2.argc; i++) {
snprintf(varname, sizeof(varname), HASH_FORMAT, arg.hashname, arg2.col[i]);
varvalue = pbx_builtin_getvar_helper(chan, varname);
strncat(buf, varvalue, len);
strncat(buf, ",", len);
strncat(buf, varvalue, len - strlen(buf) - 1);
strncat(buf, ",", len - strlen(buf) - 1);
}
/* Strip trailing comma */