postgresql-interfaces/psqlodbc GitHub issues and pull requests (mirror)  
help / color / mirror / Atom feed
From: davecramer (@davecramer) <[email protected]>
To: postgresql-interfaces/psqlodbc <[email protected]>
Subject: [postgresql-interfaces/psqlodbc] PR #174: Fix stack buffer overflow in getPrecisionPart() (GitHub #173)
Date: Wed, 22 Apr 2026 11:05:24 +0000
Message-ID: <[email protected]> (raw)

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)

view thread (2+ messages)  latest in thread

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: github://postgresql-interfaces/psqlodbc
  Cc: [email protected], [email protected]
  Subject: Re: [postgresql-interfaces/psqlodbc] PR #174: Fix stack buffer overflow in getPrecisionPart() (GitHub #173)
  In-Reply-To: <<[email protected]>>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox