mirror of
https://github.com/asterisk/asterisk.git
synced 2025-10-19 03:07:59 +00:00
Resolve issue with negative vs non-negative length parameters.
(closes issue #14245) Reported by: dveiga git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@168719 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -765,17 +765,18 @@ AST_INLINE_API(char *ast_str_append_escapecommas(struct ast_str **buf, size_t ma
|
|||||||
#include <sqlext.h>
|
#include <sqlext.h>
|
||||||
#include <sqltypes.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;
|
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) {
|
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);
|
ast_str_make_space(buf, *StrLen_or_Ind + 1);
|
||||||
}
|
}
|
||||||
maxlen = (*buf)->__AST_STR_LEN;
|
} else if (pmaxlen > 0) {
|
||||||
} else if (maxlen > 0) {
|
ast_str_make_space(buf, pmaxlen);
|
||||||
ast_str_make_space(buf, maxlen);
|
|
||||||
}
|
}
|
||||||
|
maxlen = (*buf)->__AST_STR_LEN;
|
||||||
res = SQLGetData(StatementHandle, ColumnNumber, TargetType, (*buf)->__AST_STR_STR, maxlen, StrLen_or_Ind);
|
res = SQLGetData(StatementHandle, ColumnNumber, TargetType, (*buf)->__AST_STR_STR, maxlen, StrLen_or_Ind);
|
||||||
(*buf)->__AST_STR_USED = *StrLen_or_Ind;
|
(*buf)->__AST_STR_USED = *StrLen_or_Ind;
|
||||||
return res;
|
return res;
|
||||||
|
Reference in New Issue
Block a user