fixed checktest failure due to incorrect strcpy.

Project: http://git-wip-us.apache.org/repos/asf/trafodion/repo
Commit: http://git-wip-us.apache.org/repos/asf/trafodion/commit/1cab56f2
Tree: http://git-wip-us.apache.org/repos/asf/trafodion/tree/1cab56f2
Diff: http://git-wip-us.apache.org/repos/asf/trafodion/diff/1cab56f2

Branch: refs/heads/master
Commit: 1cab56f2a261a3908d2698858c072840e791aedf
Parents: ab38cbc
Author: Anoop Sharma <anoop.sha...@esgyn.com>
Authored: Fri Aug 3 03:42:28 2018 +0000
Committer: Anoop Sharma <anoop.sha...@esgyn.com>
Committed: Fri Aug 3 03:42:28 2018 +0000

----------------------------------------------------------------------
 core/sql/exp/exp_function.cpp | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafodion/blob/1cab56f2/core/sql/exp/exp_function.cpp
----------------------------------------------------------------------
diff --git a/core/sql/exp/exp_function.cpp b/core/sql/exp/exp_function.cpp
index 38a8a43..1b47f8f 100644
--- a/core/sql/exp/exp_function.cpp
+++ b/core/sql/exp/exp_function.cpp
@@ -795,9 +795,13 @@ ExpRaiseErrorFunction::ExpRaiseErrorFunction (Attributes 
**attr,
 {
   setRaiseError(raiseError);
 
-
-  strncpy(optionalStr_, optionalStr, MAX_OPTIONAL_STR_LEN);
-  optionalStr_[MAX_OPTIONAL_STR_LEN] = 0;
+  if (optionalStr)
+    {
+      strncpy(optionalStr_, optionalStr, MAX_OPTIONAL_STR_LEN);
+      optionalStr_[MAX_OPTIONAL_STR_LEN] = 0;
+    }
+  else
+    optionalStr_[0] = 0;
 };
 
 ExFunctionRandomNum::ExFunctionRandomNum(OperatorTypeEnum opType,

Reply via email to