From e1ddaf9f73a65b28343fac59ba5cd152d3ee07d3 Mon Sep 17 00:00:00 2001 From: Eric Bollengier Date: Thu, 7 Sep 2023 17:10:19 +0200 Subject: [PATCH] win32: Fix exchange compilation --- bacula/src/win32/filed/plugins/exchange-fd.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/bacula/src/win32/filed/plugins/exchange-fd.c b/bacula/src/win32/filed/plugins/exchange-fd.c index 798608a4b..efd4bbc73 100644 --- a/bacula/src/win32/filed/plugins/exchange-fd.c +++ b/bacula/src/win32/filed/plugins/exchange-fd.c @@ -23,6 +23,7 @@ */ #include "exchange-fd.h" +#undef strncpy /* Pointers to Bacula functions */ bFuncs *bfuncs = NULL; @@ -305,7 +306,7 @@ static bRC handlePluginEvent(bpContext *ctx, bEvent *event, void *value) { _DebugMessage(0, "backup command=%s\n", (char *)value); char *command = new char[strlen((char *)value) + 1]; - strcpy(command, (char *)value); + bstrncpy(command, (char *)value, strlen((char *)value)+1); char *plugin_name = strtok((char *)command, ":"); char *path = strtok(NULL, ":"); char *option; @@ -331,7 +332,7 @@ static bRC handlePluginEvent(bpContext *ctx, bEvent *event, void *value) char *path_bit = strtok(path, "/"); for (i = 0; path_bit != NULL && i < 6; i++) { context->path_bits[i] = new char[strlen(path_bit) + 1]; - strcpy(context->path_bits[i], path_bit); + bstrncpy(context->path_bits[i], path_bit, strlen(path_bit)+1); path_bit = strtok(NULL, "/"); } -- 2.47.3