From 2824197538dc4ffddf575a95edc1cc5e5dca1eae Mon Sep 17 00:00:00 2001 From: "xiang.zhou" Date: Tue, 5 Nov 2024 08:43:47 +0800 Subject: [PATCH] plugin:buffer overflow (cherry picked from commit 3e3a583d72548af1740b3e61a5eab3b628cc439e) --- plugins/restful/plugin_handle.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/restful/plugin_handle.c b/plugins/restful/plugin_handle.c index 745d6d2ce..2e0a32451 100644 --- a/plugins/restful/plugin_handle.c +++ b/plugins/restful/plugin_handle.c @@ -40,7 +40,7 @@ void handle_add_plugin(nng_aio *aio) header.ctx = aio; header.type = NEU_REQ_ADD_PLUGIN; - strcpy(cmd.library, req->library); + strncpy(cmd.library, req->library, NEU_PLUGIN_LIBRARY_LEN); cmd.schema_file = req->schema_file; cmd.so_file = req->so_file; ret = neu_plugin_op(plugin, header, &cmd); @@ -64,7 +64,7 @@ void handle_update_plugin(nng_aio *aio) header.ctx = aio; header.type = NEU_REQ_UPDATE_PLUGIN; - strcpy(cmd.library, req->library); + strncpy(cmd.library, req->library, NEU_PLUGIN_LIBRARY_LEN); cmd.schema_file = req->schema_file; cmd.so_file = req->so_file; ret = neu_plugin_op(plugin, header, &cmd);