From 855514f4c5a02bd70f19a654788869df964f55c0 Mon Sep 17 00:00:00 2001 From: Dave Cramer Date: Tue, 8 Sep 2026 06:15:50 -0400 Subject: [PATCH] Leave the length/indicator untouched on out-of-range overflow (#207 review) On the SQL_ERROR path for a numeric-out-of-range conversion the data buffer is left untouched; skip writing the length/indicator too, for symmetry. Within spec either way (buffer/indicator undefined after SQL_ERROR), per review feedback on #210. --- convert.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/convert.c b/convert.c index 15319b02..d31a783b 100644 --- a/convert.c +++ b/convert.c @@ -2151,8 +2151,12 @@ MYLOG(DETAIL_LOG_LEVEL, "SQL_C_VARBOOKMARK value=%d\n", ival); } } - /* store the length of what was copied, if there's a place for it */ - if (pcbValue) + /* + * Store the length of what was copied, if there's a place for it. + * On an out-of-range overflow the data buffer is left untouched, so + * leave the length/indicator untouched too (issue #207). + */ + if (pcbValue && result != COPY_RESULT_OVERFLOW) *pcbValueBindRow = len; if (result == COPY_OK && stmt->current_col >= 0)