mirror of
https://github.com/asterisk/asterisk.git
synced 2025-10-03 19:16:46 +00:00
config: Fix CB_ADD_LEN() to work as originally intended.
Fix a long standing bug in CB_ADD_LEN() behaving like CB_ADD(). ASTERISK-23546 #close Reported by: Walter Doekes ........ Merged revisions 411960 from http://svn.asterisk.org/svn/asterisk/branches/1.8 ........ Merged revisions 411961 from http://svn.asterisk.org/svn/asterisk/branches/11 git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/12@411962 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -125,8 +125,10 @@ static void CB_ADD(struct ast_str **cb, const char *str)
|
|||||||
static void CB_ADD_LEN(struct ast_str **cb, const char *str, int len)
|
static void CB_ADD_LEN(struct ast_str **cb, const char *str, int len)
|
||||||
{
|
{
|
||||||
char *s = ast_alloca(len + 1);
|
char *s = ast_alloca(len + 1);
|
||||||
ast_copy_string(s, str, len);
|
|
||||||
ast_str_append(cb, 0, "%s", str);
|
memcpy(s, str, len);
|
||||||
|
s[len] = '\0';
|
||||||
|
ast_str_append(cb, 0, "%s", s);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void CB_RESET(struct ast_str *cb, struct ast_str *llb)
|
static void CB_RESET(struct ast_str *cb, struct ast_str *llb)
|
||||||
@@ -1839,7 +1841,7 @@ static struct ast_config *config_text_file_load(const char *database, const char
|
|||||||
} else if ((comment_p >= new_buf + 2) &&
|
} else if ((comment_p >= new_buf + 2) &&
|
||||||
(*(comment_p - 1) == COMMENT_TAG) &&
|
(*(comment_p - 1) == COMMENT_TAG) &&
|
||||||
(*(comment_p - 2) == COMMENT_TAG)) {
|
(*(comment_p - 2) == COMMENT_TAG)) {
|
||||||
/* Meta-Comment end detected */
|
/* Meta-Comment end detected "--;" */
|
||||||
comment--;
|
comment--;
|
||||||
new_buf = comment_p + 1;
|
new_buf = comment_p + 1;
|
||||||
if (!comment) {
|
if (!comment) {
|
||||||
|
Reference in New Issue
Block a user