]> git.ipfire.org Git - thirdparty/bacula.git/commitdiff
win32: tweak fix warning
authorAlain Spineux <alain@baculasystems.com>
Wed, 7 Jun 2023 09:48:40 +0000 (11:48 +0200)
committerEric Bollengier <eric@baculasystems.com>
Thu, 14 Sep 2023 11:57:01 +0000 (13:57 +0200)
- sendit() already handle the final '\O' no need to include it in the len
- fir warning:
In file included from /home/bac/workspace/bee/bacula/src/stored/status.c:30:
In function ‘void sendit(const char*, int, STATUS_PKT*)’,
    inlined from ‘void list_one_device(char*, DEVICE*, STATUS_PKT*, OutputWriter*)’ at /home/bac/workspace/bee/bacula/src/stored/status.c:407:24,
    inlined from ‘void list_devices(STATUS_PKT*, char*)’ at /home/bac/workspace/bee/bacula/src/stored/status.c:498:25:
/home/bac/workspace/bee/bacula/src/lib/status.h:46:13: warning: ‘void* memcpy(void*, const void*, size_t)’ forming offset 4 is out of the bounds [0, 4] [-Warray-bounds]
   46 |       memcpy(user->msg, msg, len+1);
      |       ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~

bacula/src/stored/status.c

index 2e5f321228c9cf834acc1fb746c4c6537526d7c8..0ce19f5bb17fe411698d7a2258ef10f1f958e5b5 100644 (file)
@@ -325,7 +325,7 @@ static void list_one_device(char *name, DEVICE *dev, STATUS_PKT *sp, OutputWrite
       len = Mmsg(msg, _("\nDevice \"%s\" is not open or does not exist.\n"),
                  name);
       sendit(msg, len, sp);
-      if (!sp->api) sendit("==\n", 4, sp);
+      if (!sp->api) sendit("==\n", 3, sp);
       return;
    }
 
@@ -406,7 +406,7 @@ static void list_one_device(char *name, DEVICE *dev, STATUS_PKT *sp, OutputWrite
 
    dev->show_tape_alerts((DCR *)sp, list_short, list_all, status_alert_callback);
 
-   if (!sp->api) sendit("==\n", 4, sp);
+   if (!sp->api) sendit("==\n", 3, sp);
 }
 
 static void list_one_autochanger(char *name, AUTOCHANGER *changer, STATUS_PKT *sp, OutputWriter *ow)