You are viewing a plain text version of this content. The canonical link for it is here.
Posted to codereview@trafodion.apache.org by xiaozhongwang <gi...@git.apache.org> on 2018/04/23 07:19:24 UTC

[GitHub] trafodion pull request #1534: [TRAFODION-3039] SendEventMsg is used in a wro...

GitHub user xiaozhongwang opened a pull request:

    https://github.com/apache/trafodion/pull/1534

    [TRAFODION-3039] SendEventMsg is used in a wrong way

    SendEventMsg use dynamic parameter.
    And there is a parameter control the total, all of dynamic parameters are string data type.
    But some place input a number parameter for it.
    I checked it again and found two such mistakes.

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/xiaozhongwang/trafodion TRAFODION-3039

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/trafodion/pull/1534.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #1534
    
----
commit cdd1e324e3cddbd4f52b06ea7c6556f4a2940a47
Author: Kenny <xi...@...>
Date:   2018-04-23T07:13:38Z

    fix JIRA bug 3039, SendEventMsg is used in a wrong way

----


---

[GitHub] trafodion pull request #1534: [TRAFODION-3039] SendEventMsg is used in a wro...

Posted by xiaozhongwang <gi...@git.apache.org>.
Github user xiaozhongwang closed the pull request at:

    https://github.com/apache/trafodion/pull/1534


---

[GitHub] trafodion pull request #1534: [TRAFODION-3039] SendEventMsg is used in a wro...

Posted by selvaganesang <gi...@git.apache.org>.
Github user selvaganesang commented on a diff in the pull request:

    https://github.com/apache/trafodion/pull/1534#discussion_r183770455
  
    --- Diff: core/conn/odbc/src/odbc/nsksrvrcore/srvrothers.cpp ---
    @@ -6533,6 +6533,8 @@ odbc_SQLSrvr_ExtractLob_sme_(
             if (retcode == SQL_ERROR)
             {
                 ERROR_DESC_def *p_buffer = QryLobExtractSrvrStmt->sqlError.errorList._buffer;
    +            char             errNumStr[128];
    +            sprintf(errNumStr, "%d", p_buffer->sqlcode);
                 strncpy(RequestError, p_buffer->errorText, sizeof(RequestError) - 1);
    --- End diff --
    
    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. 


---

[GitHub] trafodion pull request #1534: [TRAFODION-3039] SendEventMsg is used in a wro...

Posted by arvind-narain <gi...@git.apache.org>.
Github user arvind-narain commented on a diff in the pull request:

    https://github.com/apache/trafodion/pull/1534#discussion_r188146969
  
    --- Diff: core/conn/odbc/src/odbc/nsksrvrcore/srvrothers.cpp ---
    @@ -6533,6 +6533,8 @@ odbc_SQLSrvr_ExtractLob_sme_(
             if (retcode == SQL_ERROR)
             {
                 ERROR_DESC_def *p_buffer = QryLobExtractSrvrStmt->sqlError.errorList._buffer;
    +            char             errNumStr[128];
    +            sprintf(errNumStr, "%d", p_buffer->sqlcode);
                 strncpy(RequestError, p_buffer->errorText, sizeof(RequestError) - 1);
    --- End diff --
    
    @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.


---

[GitHub] trafodion pull request #1534: [TRAFODION-3039] SendEventMsg is used in a wro...

Posted by xiaozhongwang <gi...@git.apache.org>.
Github user xiaozhongwang commented on a diff in the pull request:

    https://github.com/apache/trafodion/pull/1534#discussion_r191289403
  
    --- Diff: core/conn/odbc/src/odbc/nsksrvrcore/srvrothers.cpp ---
    @@ -6533,6 +6533,8 @@ odbc_SQLSrvr_ExtractLob_sme_(
             if (retcode == SQL_ERROR)
             {
                 ERROR_DESC_def *p_buffer = QryLobExtractSrvrStmt->sqlError.errorList._buffer;
    +            char             errNumStr[128];
    +            sprintf(errNumStr, "%d", p_buffer->sqlcode);
                 strncpy(RequestError, p_buffer->errorText, sizeof(RequestError) - 1);
    --- End diff --
    
    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.


---

[GitHub] trafodion pull request #1534: [TRAFODION-3039] SendEventMsg is used in a wro...

Posted by xiaozhongwang <gi...@git.apache.org>.
Github user xiaozhongwang commented on a diff in the pull request:

    https://github.com/apache/trafodion/pull/1534#discussion_r186468687
  
    --- Diff: core/conn/odbc/src/odbc/nsksrvrcore/srvrothers.cpp ---
    @@ -6533,6 +6533,8 @@ odbc_SQLSrvr_ExtractLob_sme_(
             if (retcode == SQL_ERROR)
             {
                 ERROR_DESC_def *p_buffer = QryLobExtractSrvrStmt->sqlError.errorList._buffer;
    +            char             errNumStr[128];
    +            sprintf(errNumStr, "%d", p_buffer->sqlcode);
                 strncpy(RequestError, p_buffer->errorText, sizeof(RequestError) - 1);
    --- End diff --
    
    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.


---