[ODBC] Check SQLColAttribute return codes in field info functions - #293
Open
iliaal wants to merge 1 commit into
Open
[ODBC] Check SQLColAttribute return codes in field info functions#293iliaal wants to merge 1 commit into
iliaal wants to merge 1 commit into
Conversation
odbc_field_len(), odbc_field_scale() and odbc_field_type() discarded the return code of SQLColAttribute and returned uninitialized stack memory to the caller when the call failed. They now emit a warning with the driver diagnostic when available and fall back to a safe default (0 / false). odbc_bindcols() now zero-terminates column names before the SQLColAttribute call so failed name lookups cannot leak garbage; the unchecked call in odbc_result_all()'s long-column path is audited and unaffected because its output is overwritten before use.
iliaal
force-pushed
the
fix/odbc-colattribute-unchecked-84
branch
from
August 26, 2026 12:46
22798d2 to
1f20578
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
odbc_field_len(), odbc_field_scale() and odbc_field_type() discarded the SQLColAttribute return code and returned uninitialized stack memory on failure, garbage such as pointer-sized integers under LD_PRELOAD interposition. They now warn with the failing field index and any driver diagnostic, then return 0 for length and scale and false for type. Sibling audit: odbc_bindcols() could leak uninitialized column-name bytes on failed name lookups and now zero-terminates before the call; odbc_result_all()'s long-column SQLColAttribute is safe because its output is overwritten before use.