Subject: [postgresql-interfaces/psqlodbc] PR #174: Fix stack buffer overflow in getPrecisionPart() (GitHub #173)

From: "davecramer (@davecramer)" <[email-masked]>
Date: Wed, 22 Apr 2026 11:05:24 +0000

Clamp precision to the buffer size (9) before writing the NUL terminator in getPrecisionPart(). Previously, a precision value > 9 would write past the end of the local fraction[] buffer, corrupting the stack.

Also fix SQLSetDescField for ARD records: setting SQL_DESC_PRECISION, SQL_DESC_SCALE, or SQL_DESC_OCTET_LENGTH no longer nulls the data buffer. The unbind logic was incorrectly applied to these metadata fields, causing any descriptor precision override to silently unbind the column.

Add interval-overflow regression test that exercises both fixes by fetching an interval with fractional seconds using precision=20 via the ARD.

Fixes Issue #173

Reported by [@jarvis24young](https://github.com/jarvis24young) in [#173](https://github.com/postgresql-interfaces/psqlodbc/issues/173)

---

From: "jarvis24young (@jarvis24young)" <[email-masked]>
Date: Thu, 23 Apr 2026 03:48:52 +0000

thx @davecramer