]> git.ipfire.org Git - thirdparty/bacula.git/commitdiff
Fix org#2655 About incorrect definition of MAX_FOPTS
authorEric Bollengier <eric@baculasystems.com>
Fri, 5 Aug 2022 07:52:28 +0000 (09:52 +0200)
committerEric Bollengier <eric@baculasystems.com>
Fri, 5 Aug 2022 07:56:03 +0000 (09:56 +0200)
This triggers a stack buffer overflow bug in send_fileset. The
problem is that dird/fd_cmds.c includes findlib/find.h, which contains a
definition of MAX_FOPTS:

Thanks to Larry and Martin.

bacula/src/baconfig.h
bacula/src/dird/dird_conf.h
bacula/src/findlib/find.h

index 9aaed0eae47c2175bfa919f8dd0f64e18365fe6e..291e5ac0a07717cd9746af9339cf3f2639eb20c6 100644 (file)
@@ -186,6 +186,14 @@ void InitWinAPIWrapper();
 /* Use the following for strings not to be translated */
 #define NT_(s) (s)   
 
+/* Maximum number of fileset options
+ * FileSet definitions very similar to the resource
+ *  contained in the Director because the components
+ *  of the structure are passed by the Director to the
+ *  File daemon and recompiled back into this structure
+ */
+#define MAX_FOPTS 50
+
 /* This should go away! ****FIXME***** */
 #define MAXSTRING 500
 
index 1042e3647393e36b0674e3abb16902214537dd13..cfce7e9e45b1c550ad142607b96fc801d2f15e62 100644 (file)
@@ -566,10 +566,6 @@ enum {
    INC_KW_MAX                   /* Keep this last */
 };
 
-
-#undef  MAX_FOPTS
-#define MAX_FOPTS 50
-
 /* File options structure */
 struct FOPTS {
    char opts[MAX_FOPTS];              /* options string */
index 79ca579abe050221cf151731330d2a56ddb4e818..1b118bb2bfcaf1bad22b21263a44b2a4019b6ffe 100644 (file)
@@ -78,14 +78,6 @@ struct s_excluded_file {
    char fname[1];
 };
 
-/* FileSet definitions very similar to the resource
- *  contained in the Director because the components
- *  of the structure are passed by the Director to the
- *  File daemon and recompiled back into this structure
- */
-#undef  MAX_FOPTS
-#define MAX_FOPTS 30
-
 enum {
    state_none,
    state_options,