[asterisk-commits] tilghman: trunk r168719 - /trunk/include/asterisk/strings.h
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Thu Jan 15 12:39:56 CST 2009
Author: tilghman
Date: Thu Jan 15 12:39:56 2009
New Revision: 168719
URL: http://svn.digium.com/svn-view/asterisk?view=rev&rev=168719
Log:
Resolve issue with negative vs non-negative length parameters.
(closes issue #14245)
Reported by: dveiga
Modified:
trunk/include/asterisk/strings.h
Modified: trunk/include/asterisk/strings.h
URL: http://svn.digium.com/svn-view/asterisk/trunk/include/asterisk/strings.h?view=diff&rev=168719&r1=168718&r2=168719
==============================================================================
--- trunk/include/asterisk/strings.h (original)
+++ trunk/include/asterisk/strings.h Thu Jan 15 12:39:56 2009
@@ -765,17 +765,18 @@
#include <sqlext.h>
#include <sqltypes.h>
-AST_INLINE_API(SQLRETURN ast_str_SQLGetData(struct ast_str **buf, size_t maxlen, SQLHSTMT StatementHandle, SQLUSMALLINT ColumnNumber, SQLSMALLINT TargetType, SQLLEN *StrLen_or_Ind),
+AST_INLINE_API(SQLRETURN ast_str_SQLGetData(struct ast_str **buf, int pmaxlen, SQLHSTMT StatementHandle, SQLUSMALLINT ColumnNumber, SQLSMALLINT TargetType, SQLLEN *StrLen_or_Ind),
{
SQLRETURN res;
- if (maxlen == 0) {
+ size_t maxlen;
+ if (pmaxlen == 0) {
if (SQLGetData(StatementHandle, ColumnNumber, TargetType, (*buf)->__AST_STR_STR, 0, StrLen_or_Ind) == SQL_SUCCESS_WITH_INFO) {
ast_str_make_space(buf, *StrLen_or_Ind + 1);
}
- maxlen = (*buf)->__AST_STR_LEN;
- } else if (maxlen > 0) {
- ast_str_make_space(buf, maxlen);
- }
+ } else if (pmaxlen > 0) {
+ ast_str_make_space(buf, pmaxlen);
+ }
+ maxlen = (*buf)->__AST_STR_LEN;
res = SQLGetData(StatementHandle, ColumnNumber, TargetType, (*buf)->__AST_STR_STR, maxlen, StrLen_or_Ind);
(*buf)->__AST_STR_USED = *StrLen_or_Ind;
return res;
More information about the asterisk-commits
mailing list