summaryrefslogtreecommitdiff
path: root/include/asterisk
diff options
context:
space:
mode:
authorRichard Mudgett <rmudgett@digium.com>2011-09-02 17:19:17 +0000
committerRichard Mudgett <rmudgett@digium.com>2011-09-02 17:19:17 +0000
commit220bf145570d6ad584c174fc531793d699976400 (patch)
tree21a9ea444e9adf5e0f5f9ba7a86bb569770b6434 /include/asterisk
parent25a8cb4265322480f32d3561479b2b70a7255860 (diff)
Merged revisions 334297 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/10 ................ r334297 | rmudgett | 2011-09-02 12:15:08 -0500 (Fri, 02 Sep 2011) | 46 lines Merged revisions 334296 via svnmerge from https://origsvn.digium.com/svn/asterisk/branches/1.8 ........ r334296 | rmudgett | 2011-09-02 12:10:58 -0500 (Fri, 02 Sep 2011) | 39 lines Fix potential memory allocation failure crashes in config.c. * Added required checks to the returned memory allocation pointers to prevent crashes. * Made ast_include_rename() create a replacement ast_variable list node if the new filename is longer than the available space. Fixes potential crash and memory leak. * Factored out ast_variable_move() from ast_variable_update() so ast_include_rename() can also use it when creating a replacement ast_variable list node. * Made the filename stuffed at the end of the struct a minimum allocated size in ast_variable_new() in case ast_include_rename() changes the stored filename. * Constify struct char pointers pointing to strings stuffed at the end of the struct for: ast_variable, cache_file_mtime, and ast_config_map. * Factored out cfmtime_new() to remove inlined code and allow some struct pointers to become const. * Removed the list lock from struct cache_file_mtime that was never used. * Added doxygen comments to several structure elements and better documented what strings are stuffed at the struct end char array. * Reworked ast_config_text_file_save() and set_fn() to handle allocation failure of the include file scratch pad object tracking blank lines. * Made ast_config_text_file_save() fn[] declared with PATH_MAX to ensure it is long enough for any filename with path. Also reduced the number of container fileset buckets from a rediculus 180,000 to 1023. JIRA AST-618 Review: https://reviewboard.asterisk.org/r/1378/ ........ ................ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@334304 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'include/asterisk')
-rw-r--r--include/asterisk/config.h11
1 files changed, 10 insertions, 1 deletions
diff --git a/include/asterisk/config.h b/include/asterisk/config.h
index f7279f141..56401bf46 100644
--- a/include/asterisk/config.h
+++ b/include/asterisk/config.h
@@ -73,11 +73,16 @@ typedef enum {
/*! \brief Structure for variables, used for configurations and for channel variables */
struct ast_variable {
+ /*! Variable name. Stored in stuff[] at struct end. */
const char *name;
+ /*! Variable value. Stored in stuff[] at struct end. */
const char *value;
+
+ /*! Next node in the list. */
struct ast_variable *next;
- char *file;
+ /*! Filename where variable found. Stored in stuff[] at struct end. */
+ const char *file;
int lineno;
int object; /*!< 0 for variable, 1 for object */
@@ -85,6 +90,10 @@ struct ast_variable {
struct ast_comment *precomments;
struct ast_comment *sameline;
struct ast_comment *trailing; /*!< the last object in the list will get assigned any trailing comments when EOF is hit */
+ /*!
+ * \brief Contents of file, name, and value in that order stuffed here.
+ * \note File must be stuffed before name because of ast_include_rename().
+ */
char stuff[0];
};