From 06118555f993e86ec0ddf53550091393240de4c9 Mon Sep 17 00:00:00 2001 From: alexpeshkoff Date: Mon, 28 Jul 2008 10:07:09 +0000 Subject: [PATCH] Fixed bug when appending vectors, thanks to Claudio --- src/common/StatusArg.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/common/StatusArg.cpp b/src/common/StatusArg.cpp index 2061dd6ea5..ef35bc0ed1 100644 --- a/src/common/StatusArg.cpp +++ b/src/common/StatusArg.cpp @@ -78,13 +78,14 @@ bool StatusVector::append(const ISC_STATUS* from, int count) throw() { int copied = 0; - for (int i = 0; i < count; i += (from[i] == isc_arg_cstring ? 3 : 2)) + for (int i = 0; i < count; ) { - copied = i; - if (m_length + copied > FB_NELEM(m_status_vector) - 1) + i += (from[i] == isc_arg_cstring ? 3 : 2); + if (m_length + i > FB_NELEM(m_status_vector) - 1) { break; } + copied = i; } memcpy(&m_status_vector[m_length], from, copied * sizeof(m_status_vector[0]));