From 8433548573b3aa1ba58ccf14f85cfdabf9ced32e Mon Sep 17 00:00:00 2001 From: Seonah Moon Date: Wed, 25 Sep 2024 12:10:37 +0900 Subject: [PATCH] Fix ASAN issues: TNINE-4100, 4102 Change-Id: Iad90b16a9cdfc170f01d274a250143273037ea28 --- packaging/capi-network-vine.spec | 2 +- plugins/libwebsockets/libwebsockets-plugin.cpp | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/packaging/capi-network-vine.spec b/packaging/capi-network-vine.spec index b8d734f..d4a07db 100755 --- a/packaging/capi-network-vine.spec +++ b/packaging/capi-network-vine.spec @@ -3,7 +3,7 @@ %bcond_without use_glib_event_loop Name: capi-network-vine Summary: An service discovery framework -Version: 1.3.3 +Version: 1.3.4 Release: 0 Group: Network & Connectivity/API License: Apache-2.0 diff --git a/plugins/libwebsockets/libwebsockets-plugin.cpp b/plugins/libwebsockets/libwebsockets-plugin.cpp index 034c685..dd1ae23 100755 --- a/plugins/libwebsockets/libwebsockets-plugin.cpp +++ b/plugins/libwebsockets/libwebsockets-plugin.cpp @@ -1282,7 +1282,7 @@ static int websocket_set_token(vine_dp_plugin_h handle, const char *token) return -1; ws->token_len = len; - ws->token = (unsigned char *)calloc(len, sizeof(unsigned char)); + ws->token = (unsigned char *)calloc(len + 1, sizeof(unsigned char)); memcpy(ws->token, token, ws->token_len); return VINE_DATA_PATH_ERROR_NONE; } @@ -1298,7 +1298,7 @@ static int websocket_get_token(vine_dp_plugin_h handle, char **token) return VINE_DATA_PATH_ERROR_INVALID_OPERATION; } - *token = (char *)calloc(ws->token_len, sizeof(char)); + *token = (char *)calloc(ws->token_len + 1, sizeof(char)); memcpy(*token, ws->token, ws->token_len); return VINE_DATA_PATH_ERROR_NONE; } -- 2.34.1