Skip to content

Commit

Permalink
Merge pull request #21899 from taosdata/fix/td-24964
Browse files Browse the repository at this point in the history
fix: fix coverity scan issues
  • Loading branch information
dapan1121 committed Jun 30, 2023
2 parents dfbd7ea + e05b7dc commit 61d57aa
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions source/libs/function/src/udfd.c
Original file line number Diff line number Diff line change
Expand Up @@ -61,15 +61,14 @@ const char *udfdCPluginUdfInitLoadInitDestoryFuncs(SUdfCPluginCtx *udfCtx, const

char destroyFuncName[TSDB_FUNC_NAME_LEN + 9] = {0};
char *destroySuffix = "_destroy";
strcpy(destroyFuncName, udfName);
snprintf(destroyFuncName, sizeof(destroyFuncName), "%s%s", udfName, destroySuffix);
uv_dlsym(&udfCtx->lib, destroyFuncName, (void **)(&udfCtx->destroyFunc));
return udfName;
}

void udfdCPluginUdfInitLoadAggFuncs(SUdfCPluginCtx *udfCtx, const char *udfName) {
char processFuncName[TSDB_FUNC_NAME_LEN] = {0};
strcpy(processFuncName, udfName);
strncpy(processFuncName, udfName, sizeof(processFuncName));
uv_dlsym(&udfCtx->lib, processFuncName, (void **)(&udfCtx->aggProcFunc));

char startFuncName[TSDB_FUNC_NAME_LEN + 7] = {0};
Expand All @@ -94,6 +93,7 @@ int32_t udfdCPluginUdfInit(SScriptUdfInfo *udf, void **pUdfCtx) {
err = uv_dlopen(udf->path, &udfCtx->lib);
if (err != 0) {
fnError("can not load library %s. error: %s", udf->path, uv_strerror(err));
taosMemoryFree(udfCtx);
return TSDB_CODE_UDF_LOAD_UDF_FAILURE;
}
const char *udfName = udf->name;
Expand All @@ -102,7 +102,7 @@ int32_t udfdCPluginUdfInit(SScriptUdfInfo *udf, void **pUdfCtx) {

if (udf->funcType == UDF_FUNC_TYPE_SCALAR) {
char processFuncName[TSDB_FUNC_NAME_LEN] = {0};
strcpy(processFuncName, udfName);
strncpy(processFuncName, udfName, sizeof(processFuncName));
uv_dlsym(&udfCtx->lib, processFuncName, (void **)(&udfCtx->scalarProcFunc));
} else if (udf->funcType == UDF_FUNC_TYPE_AGG) {
udfdCPluginUdfInitLoadAggFuncs(udfCtx, udfName);
Expand Down

0 comments on commit 61d57aa

Please sign in to comment.