Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Silent truncation of 'long' diagnostic messages in SQLGetDiagRec #78

Closed
matthew-wozniczka opened this issue Jun 1, 2022 · 2 comments
Closed

Comments

@matthew-wozniczka
Copy link

See

snprintf (msgbuf, sizeof (msgbuf), "%s%s", sqlerrhd, errmsg);

It's using a fixed size buffer, and there's no checks I could find on the size of a diagnostic message when being added via _iodbcdm_pushsqlerr(), so this will just silently truncate it

@matthew-wozniczka
Copy link
Author

This could happen from

PUSHSYSERR (pdbc->herr, _iodbcdm_dllerror ());
for instance

@matthew-wozniczka
Copy link
Author

matthew-wozniczka commented Jun 1, 2022

I'm investigating a test failure where our driver fails to connect, and it seems (haven't verified yet) that iODBC is truncating the diagnostic message to "[iODBC][Driver Manager]dlopen(/Users/bamboo/bamboo-agent-home/x". The fact that it's 63 characters makes me think there's a 64 * CODEUNIT_SIZE limit somewhere. Looking more closely at what I pointed out, the 256 char buffer doesn't seem like it would be the cause... But I think it's still a possible issue.

Our driver is a unicode driver btw, and the application is calling into SQLGetDiagRecW, and we're using 3.52.15

@pkleef pkleef closed this as completed in 00489b4 Oct 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant