[Home]

Summary:ASTERISK-11196: Binds a local variable, and uses it once its out of scope
Reporter:Nick Gorham (lurcher)Labels:
Date Opened:2008-01-10 07:54:38.000-0600Date Closed:2008-01-10 11:38:05.000-0600
Priority:MajorRegression?No
Status:Closed/CompleteComponents:CDR/cdr_odbc
Versions:Frequency of
Occurrence
Related
Issues:
Environment:Attachments:( 0) cdr_odbc.c.patch
Description:The code has been chaned to prepare the query, and then binds the values to be inserted. However the timestamp is a local string. Now the execute is not in the same function, the memory use is not valid

****** ADDITIONAL INFORMATION ******

Attached is a patch that fixes the problem.
Comments:By: Michiel van Baak (mvanbaak) 2008-01-10 08:00:52.000-0600

did you forget to upload the patch ?

By: Nick Gorham (lurcher) 2008-01-10 08:02:37.000-0600

Patch not attached, as I seem to be required to sign a document to provide a fix to GPL software!!!

By: Tilghman Lesher (tilghman) 2008-01-10 08:12:49.000-0600

I think you're incorrect.  There is no such problem with this code.  Unless you have a crash to report, I am closing this out.

By: Nick Gorham (lurcher) 2008-01-10 08:21:56.000-0600

Please yourself, but you are wrong, given that I run the unixODBC project, do you think there may be a potential for my knowing a little more about ODBC than you do?

No?

Ok, then using the cdr_odbc.c revision 89512, look in the function prepare_cb() and at the variable timestr, and tell me when the address of this string thats passed to SQLBindParameter is actually used?

Hint, its not when SQLBindParameter is called.

By: Nick Gorham (lurcher) 2008-01-10 08:46:38.000-0600

Oh, and it gets better, now I see my Karma is -2 because I failed to provide information to allow but to be fixed. Great!!!

By: Michiel van Baak (mvanbaak) 2008-01-10 08:50:30.000-0600

If you can provide more info and a patch with a signed disclaimer feel free to reopen this issue.

By: Nick Gorham (lurcher) 2008-01-10 10:07:51.000-0600

Ok, I will upload the patch. Not worth the grief

By: Digium Subversion (svnbot) 2008-01-10 11:36:31.000-0600

Repository: asterisk
Revision: 97805

U   trunk/cdr/cdr_odbc.c

------------------------------------------------------------------------
r97805 | tilghman | 2008-01-10 11:36:30 -0600 (Thu, 10 Jan 2008) | 3 lines

Fix problem with timestr going out of scope
(Closes issue ASTERISK-11196, closes issue ASTERISK-11201)

------------------------------------------------------------------------

http://svn.digium.com/view/asterisk?view=rev&revision=97805