Summary: | ASTERISK-11144: Using static realtime configuration with postgres crashes Asterisk on startup | ||
Reporter: | Tiziano Martelli (tiziano) | Labels: | |
Date Opened: | 2008-01-03 11:34:17.000-0600 | Date Closed: | 2008-01-03 15:42:14.000-0600 |
Priority: | Major | Regression? | No |
Status: | Closed/Complete | Components: | Resources/res_config_pgsql |
Versions: | Frequency of Occurrence | ||
Related Issues: | |||
Environment: | Attachments: | ||
Description: | In res_config_pgsql.c there is a string pointer used but not initialized to any storage area; so a: Segmentation fault is generated every time a static realtime configuration is used. The broken function is: config_pgsql (line 492 on 1.4.17 release) the variable is: char *sql; (line 501 on 1.4.17 release) and should be char *sql = sqlbuf; I found the error in 1.4.15 for the first time (I've note searched before) and it's still there ****** ADDITIONAL INFORMATION ****** I've tried to set up a patch. The following is mine res_config_pgsql.patch (I've manually changed the left spaces to tabs to have it working): --- res_config_pgsql.c.orig 2008-01-03 18:26:12.381629955 +0100 +++ res_config_pgsql.c 2008-01-03 18:26:52.558924576 +0100 @@ -498,7 +498,7 @@ struct ast_variable *new_v; struct ast_category *cur_cat = NULL; char sqlbuf[1024] = ""; - char *sql; + char *sql = sqlbuf; size_t sqlleft = sizeof(sqlbuf); char last[80] = ""; int last_cat_metric = 0; | ||
Comments: | By: Digium Subversion (svnbot) 2008-01-03 15:33:46.000-0600 Repository: asterisk Revision: 96318 U branches/1.4/res/res_config_pgsql.c ------------------------------------------------------------------------ r96318 | tilghman | 2008-01-03 15:33:45 -0600 (Thu, 03 Jan 2008) | 4 lines Missed initialization caused crash. Reported and fixed by: tiziano (Closes issue ASTERISK-11144) ------------------------------------------------------------------------ http://svn.digium.com/view/asterisk?view=rev&revision=96318 By: Digium Subversion (svnbot) 2008-01-03 15:40:33.000-0600 Repository: asterisk Revision: 96332 _U trunk/ U trunk/res/res_config_pgsql.c ------------------------------------------------------------------------ r96332 | tilghman | 2008-01-03 15:40:33 -0600 (Thu, 03 Jan 2008) | 12 lines Merged revisions 96318 via svnmerge from https://origsvn.digium.com/svn/asterisk/branches/1.4 ........ r96318 | tilghman | 2008-01-03 15:37:02 -0600 (Thu, 03 Jan 2008) | 4 lines Missed initialization caused crash. Reported and fixed by: tiziano (Closes issue ASTERISK-11144) ........ ------------------------------------------------------------------------ http://svn.digium.com/view/asterisk?view=rev&revision=96332 By: Tilghman Lesher (tilghman) 2008-01-03 15:42:14.000-0600 This was committed, because the fix was simply functional. However, in the future, please submit a license agreement and upload your changes as patches (as files). |