[asterisk-bugs] [Asterisk 0014245]: SQLGetData returns no data

Asterisk Bug Tracker noreply at bugs.digium.com
Thu Jan 15 12:39:56 CST 2009


A NOTE has been added to this issue. 
====================================================================== 
http://bugs.digium.com/view.php?id=14245 
====================================================================== 
Reported By:                dveiga
Assigned To:                Corydon76
====================================================================== 
Project:                    Asterisk
Issue ID:                   14245
Category:                   Functions/func_odbc
Reproducibility:            always
Severity:                   major
Priority:                   normal
Status:                     assigned
Asterisk Version:           SVN 
Regression:                 No 
SVN Branch (only for SVN checkouts, not tarball releases):  trunk 
SVN Revision (number only!): 168053 
Request Review:              
====================================================================== 
Date Submitted:             2009-01-14 22:28 CST
Last Modified:              2009-01-15 12:39 CST
====================================================================== 
Summary:                    SQLGetData returns no data
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.
====================================================================== 

---------------------------------------------------------------------- 
 (0097946) svnbot (reporter) - 2009-01-15 12:39
 http://bugs.digium.com/view.php?id=14245#c97946 
---------------------------------------------------------------------- 
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 http://bugs.digium.com/view.php?id=14245)
 Reported by: dveiga

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

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

Issue History 
Date Modified    Username       Field                    Change               
====================================================================== 
2009-01-15 12:39 svnbot         Checkin                                      
2009-01-15 12:39 svnbot         Note Added: 0097946                          
======================================================================




More information about the asterisk-bugs mailing list