[asterisk-dev] cdr_odbc.c is broken in trunk
Tilghman Lesher
tilghman at mail.jeffandtilghman.com
Thu Jan 10 11:02:55 CST 2008
On Thursday 10 January 2008 10:31:13 Kevin P. Fleming wrote:
> Tilghman Lesher wrote:
> > Uh, no, the stack doesn't work that way. The entire contents of
> > timestr[] remain valid and unchanged until the stack frame is popped.
> > Which will not happen until odbc_log() exits. The only reason this
> > location would be overwritten is if there's a stack overflow error (not
> > impossible, but we've been fairly diligent in finding those issues).
>
> This is incorrect. The variable being referred to here ('timestr' in
> prepare_cb) is allocated on the stack when prepare_cb() is entered and
> then that stack frame is released when prepare_cb() exits. Since
> ast_odbc_prepare_and_execute() calls prepare_cb() and then later calls
> SQLExecute(), the memory for this bound parameter will now be used for
> something else (probably the stack frame for SQLExecute() itself).
Aha. The original problem report suggested that the problem was in 1.4.17,
so I was looking in the 1.4 branch.
--
Tilghman
More information about the asterisk-dev
mailing list