[Home]

Summary:ASTERISK-13371: SQLGetData returns no data
Reporter:Daniel A. Veiga (dveiga)Labels:
Date Opened:2009-01-14 22:28:29.000-0600Date Closed:2009-01-15 12:40:55.000-0600
Priority:MajorRegression?No
Status:Closed/CompleteComponents:Functions/func_odbc
Versions:Frequency of
Occurrence
Related
Issues:
Environment:Attachments:
Description:When ast_str_SQLGetData() is called with maxlen<0, it simply calls SQLGetData() passing maxlen as the buffer length. As it is negative, SQLGetData() returns SQL_SUCCESS_WITH_INFO indicating the data doesn´t fit into the buffer and no data is returned. When I got to this point I was happy, I thought the problem could be easily solved using the actual buffer length (held in the __AST_STR_LEN field) instead of maxlen when calling SQLGetData().

But when I did so I stuck into a bigger problem: In my platform (Fedora Linux  2.6.26.5-45.fc9.x86_64), size_t seems to be unsigned!!! This causes the comparison 'maxlen>0' inside ast_str_SQLGetData() to be always true and ast_str_make_space() getting called to allocate a buffer for it.

I can still work on the problem, but as it might involve bigger changes like changing types I prefer to listen to your comments first.
Comments:By: Digium Subversion (svnbot) 2009-01-15 12:39:56.000-0600

Repository: asterisk
Revision: 168719

U   trunk/include/asterisk/strings.h

------------------------------------------------------------------------
r168719 | tilghman | 2009-01-15 12:39:56 -0600 (Thu, 15 Jan 2009) | 4 lines

Resolve issue with negative vs non-negative length parameters.
(closes issue ASTERISK-13371)
Reported by: dveiga

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

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

By: Digium Subversion (svnbot) 2009-01-15 12:40:55.000-0600

Repository: asterisk
Revision: 168720

_U  branches/1.6.1/

------------------------------------------------------------------------
r168720 | tilghman | 2009-01-15 12:40:55 -0600 (Thu, 15 Jan 2009) | 10 lines

Blocked revisions 168719 via svnmerge

........
 r168719 | tilghman | 2009-01-15 12:39:56 -0600 (Thu, 15 Jan 2009) | 4 lines
 
 Resolve issue with negative vs non-negative length parameters.
 (closes issue ASTERISK-13371)
  Reported by: dveiga
........

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

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