Github user xiaozhongwang commented on a diff in the pull request:
https://github.com/apache/trafodion/pull/1582#discussion_r191290915
--- Diff: core/conn/odbc/src/odbc/nsksrvrcore/srvrothers.cpp ---
@@ -6533,6 +6535,8 @@ odbc_SQLSrvr_ExtractLob_sme_(
if (retcode == SQL_ERROR)
{
ERROR_DESC_def *p_buffer =
QryLobExtractSrvrStmt->sqlError.errorList._buffer;
+ char errNumStr[128] = {0};
+ sprintf(errNumStr, "%d", (int)p_buffer->sqlcode);
--- End diff --
selvaganesang on 24 Apr Contributor
Surround code issue. RequestError may not be null terminated when the
RequestError size is less than the length of the string in p_buffer->errorText.
Also, this can cause core dump due to segment violation if length of errorText
is less than the size of RequestBuffer.
@xiaozhongwang
xiaozhongwang an hour ago Contributor
I don't understand you question, do you think RequestError is too small?
Here used strncpy, the error message may be cut, I don't think it can cause
core dump.
@arvind-narain
arvind-narain 14 days ago Contributor
@selvaganesang since RequestError is initialized at line 6489 and 6585, is
there still a concern?
char RequestError[200] = {0};
@xiaozhongwang if you want you could also take care of line 5254 ?
Also do check regarding %d vs. %ld for sqlcode.
Sorry for the delay in review. Thanks for the change.
@xiaozhongwang
xiaozhongwang 15 minutes ago Contributor
I don't look for this fix a long time. the branch have been deleted.
So I pull a new request for this, modified as your suggestion.
---