[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.
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 return code of SQLColAttribute and returned uninitialized stack memory when the call failed, which LD_PRELOAD interposition confirmed with garbage values such as pointer-sized integers. They now emit a warning carrying the failing field index and the driver diagnostic when one is available, and fall back to a safe default of 0 for length and scale and false for type. The sibling audit found odbc_bindcols() could leak uninitialized column-name bytes on failed name lookups, so it zero-terminates before the call, while the unchecked SQLColAttribute in odbc_result_all()'s long-column path is unaffected because its output is overwritten before use.