[prev in list] [next in list] [prev in thread] [next in thread] 

List:       asterisk-dev
Subject:    Re: [asterisk-dev] cdr_odbc.c is broken in trunk
From:       "Kevin P. Fleming" <kpfleming () digium ! com>
Date:       2008-01-10 16:31:13
Message-ID: 47864851.7050209 () digium ! com
[Download RAW message or body]

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).

-- 
Kevin P. Fleming
Director of Software Technologies
Digium, Inc. - "The Genuine Asterisk Experience" (TM)

_______________________________________________
--Bandwidth and Colocation Provided by http://www.api-digital.com--

asterisk-dev mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-dev
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic