Merge "core: Fix handling of maximum length lines in config files."

changes/24/8424/2
Jenkins2 8 years ago committed by Gerrit Code Review
commit 3afc2c52af

@ -145,8 +145,9 @@ maxlogins=3
; You can select between two variables by using dialplan functions, e.g. ; You can select between two variables by using dialplan functions, e.g.
; ${IF(${ISNULL(${ORIG_VM_DATE})}?${VM_DATE}:${ORIG_VM_DATE})} ; ${IF(${ISNULL(${ORIG_VM_DATE})}?${VM_DATE}:${ORIG_VM_DATE})}
; ;
; Note: The emailbody config row can only be up to 512 characters due to a ; Note: The emailbody config row can only be up to 8190 characters due to a
; limitation in the Asterisk configuration subsystem. ; limitation in the Asterisk configuration subsystem. If compiled with
; LOW_MEMORY the limit is 510 characters.
;emailsubject=[PBX]: New message ${VM_MSGNUM} in mailbox ${VM_MAILBOX} ;emailsubject=[PBX]: New message ${VM_MSGNUM} in mailbox ${VM_MAILBOX}
; The following definition is very close to the default, but the default shows ; The following definition is very close to the default, but the default shows
; just the CIDNAME, if it is not null, otherwise just the CIDNUM, or "an unknown ; just the CIDNAME, if it is not null, otherwise just the CIDNUM, or "an unknown

@ -2195,10 +2195,10 @@ static struct ast_config *config_text_file_load(const char *database, const char
lineno++; lineno++;
if (fgets(buf, sizeof(buf), f)) { if (fgets(buf, sizeof(buf), f)) {
/* Skip lines that are too long */ /* Skip lines that are too long */
if (strlen(buf) == sizeof(buf) - 1 && buf[sizeof(buf) - 1] != '\n') { if (strlen(buf) == sizeof(buf) - 1 && buf[sizeof(buf) - 2] != '\n') {
ast_log(LOG_WARNING, "Line %d too long, skipping. It begins with: %.32s...\n", lineno, buf); ast_log(LOG_WARNING, "Line %d too long, skipping. It begins with: %.32s...\n", lineno, buf);
while (fgets(buf, sizeof(buf), f)) { while (fgets(buf, sizeof(buf), f)) {
if (strlen(buf) != sizeof(buf) - 1 || buf[sizeof(buf) - 1] == '\n') { if (strlen(buf) != sizeof(buf) - 1 || buf[sizeof(buf) - 2] == '\n') {
break; break;
} }
} }

Loading…
Cancel
Save