]> git.ipfire.org Git - thirdparty/bacula.git/commitdiff
Fix windows compilation
authorEric Bollengier <eric@baculasystems.com>
Thu, 4 Feb 2021 10:31:27 +0000 (11:31 +0100)
committerEric Bollengier <eric@baculasystems.com>
Fri, 26 Mar 2021 13:57:58 +0000 (14:57 +0100)
bacula/src/findlib/drivetype.c

index c6d21bfcabe3f9041dd7f56e95e1e14de59a8f9a..2d8866233900f384991b260d73952ca031dd8204 100644 (file)
@@ -57,9 +57,8 @@ bool drivetype(const char *fname, char *dt, int dtlen)
    CHAR rootpath[4];
    UINT type;
 
-   /* Copy Drive Letter, colon, and backslash to rootpath */
-   bstrncpy(rootpath, fname, 3);
-   rootpath[3] = '\0';
+   /* Copy Drive Letter, colon, and backslash to rootpath. bstrncpy will null-terminate the string  */
+   bstrncpy(rootpath, fname, sizeof(rootpath));
 
    type = GetDriveType(rootpath);