]> git.ipfire.org Git - thirdparty/bacula.git/commitdiff
win32: Fix exchange compilation
authorEric Bollengier <eric@baculasystems.com>
Thu, 7 Sep 2023 15:10:19 +0000 (17:10 +0200)
committerEric Bollengier <eric@baculasystems.com>
Thu, 14 Sep 2023 11:57:02 +0000 (13:57 +0200)
bacula/src/win32/filed/plugins/exchange-fd.c

index 798608a4bf67a1091be1cfe22c8351cf00fb68b6..efd4bbc733ea9fc37263ceb4645a5dcccf40fba8 100644 (file)
@@ -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, "/");
       }