Index: main/config.c =================================================================== --- main/config.c (revision 117660) +++ main/config.c (working copy) @@ -59,6 +59,7 @@ #define COMMENT_END "--;" #define COMMENT_META ';' #define COMMENT_TAG '-' +#define BUFSIZE 8192 static char *extconfig_conf = "extconfig.conf"; @@ -812,7 +813,7 @@ static struct ast_config *config_text_file_load(const char *database, const char *table, const char *filename, struct ast_config *cfg, int withcomments) { char fn[256]; - char buf[8192]; + char *buf; char *new_buf, *comment_p, *process_buf; FILE *f; int lineno=0; @@ -827,6 +828,7 @@ char *lline_buffer=0; /*!< A buffer for stuff behind the ; */ int lline_buffer_size=0; + buf = ast_malloc(BUFSIZE); cat = ast_config_get_current_category(cfg); @@ -840,6 +842,7 @@ CB_INIT(&comment_buffer, &comment_buffer_size, &lline_buffer, &lline_buffer_size); if (!lline_buffer || !comment_buffer) { ast_log(LOG_ERROR, "Failed to initialize the comment buffer!\n"); + free(buf); return NULL; } } @@ -891,7 +894,7 @@ ast_verbose("Found\n"); while(!feof(f)) { lineno++; - if (fgets(buf, sizeof(buf), f)) { + if (fgets(buf, BUFSIZE, f)) { if ( withcomments ) { CB_ADD(&comment_buffer, &comment_buffer_size, lline_buffer); /* add the current lline buffer to the comment buffer */ lline_buffer[0] = 0; /* erase the lline buffer */ @@ -990,6 +993,8 @@ comment_buffer_size = 0; lline_buffer_size = 0; } + + free(buf); if (count == 0) return NULL;