mirror of
https://github.com/asterisk/asterisk.git
synced 2025-11-19 00:00:09 +00:00
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/branches/1.4@106552 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -1091,16 +1091,16 @@ int ast_codec_pref_string(struct ast_codec_pref *pref, char *buf, size_t size)
|
||||
slen = strlen(formatname);
|
||||
if(slen > total_len)
|
||||
break;
|
||||
strncat(buf,formatname,total_len);
|
||||
strncat(buf, formatname, total_len - 1); /* safe */
|
||||
total_len -= slen;
|
||||
}
|
||||
if(total_len && x < 31 && ast_codec_pref_index(pref , x + 1)) {
|
||||
strncat(buf,"|",total_len);
|
||||
strncat(buf, "|", total_len - 1); /* safe */
|
||||
total_len--;
|
||||
}
|
||||
}
|
||||
if(total_len) {
|
||||
strncat(buf,")",total_len);
|
||||
strncat(buf, ")", total_len - 1); /* safe */
|
||||
total_len--;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user