diff --git a/utils/funcexp/func_decode.cpp b/utils/funcexp/func_decode.cpp index e73d84818..92442cee1 100644 --- a/utils/funcexp/func_decode.cpp +++ b/utils/funcexp/func_decode.cpp @@ -5,6 +5,7 @@ using namespace std; #include "functor_str.h" #include "funchelpers.h" #include "functioncolumn.h" +#include "vlarray.h" using namespace execplan; namespace funcexp @@ -51,8 +52,8 @@ string Func_decode::getStrVal(rowgroup::Row& row, int nStrLen = str.length(); int nPassLen = password.length(); - char res[nStrLen+1]; - memset(res,0,nStrLen+1); + utils::VLArray res(nStrLen + 1); + memset(res.data(),0,nStrLen+1); if (!fSeeded) { @@ -61,11 +62,11 @@ string Func_decode::getStrVal(rowgroup::Row& row, fSeeded = true; } - memcpy(res,str.c_str(),nStrLen); - sql_crypt.decode(res,nStrLen); + memcpy(res.data(),str.c_str(),nStrLen); + sql_crypt.decode(res.data(),nStrLen); sql_crypt.reinit(); - return res; + return res.data(); } } diff --git a/utils/funcexp/func_encode.cpp b/utils/funcexp/func_encode.cpp index 20cda7665..5e1d27360 100644 --- a/utils/funcexp/func_encode.cpp +++ b/utils/funcexp/func_encode.cpp @@ -5,6 +5,7 @@ using namespace std; #include "functor_str.h" #include "funchelpers.h" #include "functioncolumn.h" +#include "vlarray.h" using namespace execplan; namespace funcexp @@ -53,8 +54,9 @@ string Func_encode::getStrVal(rowgroup::Row& row, int nStrLen = str.length(); int nPassLen = password.length(); - char res[nStrLen+1]; - memset(res,0,nStrLen+1); + utils::VLArray res(nStrLen + 1); + memset(res.data(),0,nStrLen+1); + if (!fSeeded) { @@ -63,11 +65,11 @@ string Func_encode::getStrVal(rowgroup::Row& row, fSeeded = true; } - memcpy(res,str.c_str(),nStrLen); - sql_crypt.encode(res,nStrLen); + memcpy(res.data(),str.c_str(),nStrLen); + sql_crypt.encode(res.data(),nStrLen); sql_crypt.reinit(); - return res; + return res.data(); } }