[asterisk-dev] [Code Review] 3985: realtime configuration: anything that goes through ast_destroy_realtime crashes if only a single key/value pair is used.

Jonathan Rose reviewboard at asterisk.org
Tue Sep 9 12:04:44 CDT 2014


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviewboard.asterisk.org/r/3985/
-----------------------------------------------------------

(Updated Sept. 9, 2014, 12:04 p.m.)


Review request for Asterisk Developers.


Changes
-------

Accidentally named the wrong function in the summary.


Summary (updated)
-----------------

realtime configuration: anything that goes through ast_destroy_realtime crashes if only a single key/value pair is used.


Bugs: ASTERISK-24231
    https://issues.asterisk.org/jira/browse/ASTERISK-24231


Repository: Asterisk


Description
-------

Attempting to use the following CLI command would cause a crash (regardless of whether a realtime database were in any way configured)

realtime destroy (any table) field1 value1

This was due to attempting to create a variable list from a NULL name since we sent an empty va list to a function that creates variable lists from va lists.

I've changed that function to be tolerant of empty va lists and I've changed the ast_realtime_destroy function to go ahead and call the realtime engine destroy functions even if the variable list that it gets back from that function is NULL.


Diffs
-----

  /branches/12/main/config.c 422869 

Diff: https://reviewboard.asterisk.org/r/3985/diff/


Testing
-------

I tested the changes against both a postgres database connected via res_config_pgsql and a mysql database connected via res_config_odbc. Of the two, res_config_odbc appeared to be the more likely source of trouble since it might use the variable list for something other than just iteration. It appears to set a string field to the variable list for whatever reason... in any event, both appeared to work fine and I didn't notice anything out of the ordinary happening due to deallocation or anything.

I went ahead and checked all the other realtime engines to make sure their destroy functions looked like they would be compatible with NULL variable lists as well and they all checked out... they just add entries by iterating along the list and if it's NULL it just won't enter the loop in each case.


Thanks,

Jonathan Rose

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-dev/attachments/20140909/317bfc4e/attachment.html>


More information about the asterisk-dev mailing list