Github user selvaganesang commented on a diff in the pull request:

    https://github.com/apache/incubator-trafodion/pull/909#discussion_r98810157
  
    --- Diff: core/sql/arkcmp/CompException.cpp ---
    @@ -113,11 +114,21 @@ FatalException::FatalException(const char *msg,
       else {
         msg_[0] = 0;
       }
    +  if(stackTrace) {
    +    strncpy(stackTrace_, stackTrace, sizeof(stackTrace_));
    +    stackTrace_[sizeof(stackTrace_)-1] = 0;
    --- End diff --
    
    @prashanth-vasudev What I meant is if the stackTrace_ is declared as char 
*, then sizeof(stackTrace_) would return 4 or 8 bytes irrespective of the 
buffer size that was allocated to hold the stack trace. If it is declared as 
char stackTrace_[<max_stack_trace_len>], then sizeof(stackTrace_) will be 
correct. 
    
    This article illustrates the concern I mentioned via a program. 
    http://www.geeksforgeeks.org/using-sizof-operator-with-array-paratmeters/
    
    This may not be applicable here though because stackTrace_ is the member 
variable of the class and this is the method of the class.
    



---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

Reply via email to