From dd6aa6792072dae5bf652965ac5381caadc7c143 Mon Sep 17 00:00:00 2001 From: hvlad Date: Fri, 20 Apr 2007 11:18:51 +0000 Subject: [PATCH] Fixed bug CORE-1218 : isc_dsql_info (isc_info_sql_stmt_type) not set isc_info_end at the end of the passed user's buffer --- src/jrd/why.cpp | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/src/jrd/why.cpp b/src/jrd/why.cpp index e75ba9170a..bc99cc5432 100644 --- a/src/jrd/why.cpp +++ b/src/jrd/why.cpp @@ -3611,10 +3611,19 @@ ISC_STATUS API_ROUTINE GDS_DSQL_SQL_INFO(ISC_STATUS* user_status, (statement->flags & HANDLE_STATEMENT_prepared) && statement->das.dasup_stmt_type) { - *buffer++ = isc_info_sql_stmt_type; - put_short((UCHAR*) buffer, 4); - buffer += 2; - put_long((UCHAR*) buffer, statement->das.dasup_stmt_type); + if (buffer_length >= 8) + { + *buffer++ = isc_info_sql_stmt_type; + put_short((UCHAR*) buffer, 4); + buffer += 2; + put_long((UCHAR*) buffer, statement->das.dasup_stmt_type); + buffer += 4; + *buffer = isc_info_end; + } + else + { + *buffer = isc_info_truncated; + } } else {