Skip to content

Commit 5e1ecff

Browse files
committed
Patch: Fixed crash after calling incorrectly parametrized request
1 parent 700f474 commit 5e1ecff

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

src/jrd/extds/ExtDS.cpp

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2237,6 +2237,12 @@ void Statement::setInParams(thread_db* tdbb, const MetaName* const* names,
22372237
const FB_SIZE_T excCount = in_excess ? in_excess->getCount() : 0;
22382238
const FB_SIZE_T sqlCount = m_sqlParamNames.getCount();
22392239

2240+
if (m_error = (!names && sqlCount))
2241+
{
2242+
// Parameter name expected
2243+
ERR_post(Arg::Gds(isc_eds_prm_name_expected));
2244+
}
2245+
22402246
// OK : count - excCount <= sqlCount <= count
22412247

22422248
// Check if all passed named parameters, not marked as excess, are present in query text
@@ -2273,16 +2279,13 @@ void Statement::setInParams(thread_db* tdbb, const MetaName* const* names,
22732279
const MetaString* sqlName = m_sqlParamsMap[sqlNum];
22742280

22752281
unsigned int num = 0;
2276-
if (names)
2282+
for (; num < count; num++)
22772283
{
2278-
for (; num < count; num++)
2279-
{
2280-
if (*names[num] == *sqlName)
2281-
break;
2282-
}
2284+
if (*names[num] == *sqlName)
2285+
break;
22832286
}
22842287

2285-
if (!names || (num == count))
2288+
if (num == count)
22862289
{
22872290
m_error = true;
22882291
// Input parameter ''@1'' have no value set

0 commit comments

Comments
 (0)