summaryrefslogtreecommitdiff
path: root/include/asterisk/strings.h
diff options
context:
space:
mode:
authorTilghman Lesher <tilghman@meg.abyt.es>2009-01-15 18:39:56 +0000
committerTilghman Lesher <tilghman@meg.abyt.es>2009-01-15 18:39:56 +0000
commitc6cb67b94129ee4846aa7885d788c5c314577fd3 (patch)
tree9956228a55aa80bd5d6cebf047130118021d921d /include/asterisk/strings.h
parent8ab629c76783c2812773f1f219bb643fccb32b99 (diff)
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
Diffstat (limited to 'include/asterisk/strings.h')
-rw-r--r--include/asterisk/strings.h11
1 files changed, 6 insertions, 5 deletions
diff --git a/include/asterisk/strings.h b/include/asterisk/strings.h
index bf3cf3236..53302874e 100644
--- a/include/asterisk/strings.h
+++ b/include/asterisk/strings.h
@@ -765,17 +765,18 @@ AST_INLINE_API(char *ast_str_append_escapecommas(struct ast_str **buf, size_t ma
#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;