]> git.ipfire.org Git - thirdparty/bacula.git/commitdiff
BEE Backport bacula/src/findlib/win32filter.h
authorAlain Spineux <alain@baculasystems.com>
Mon, 20 Apr 2020 14:45:14 +0000 (16:45 +0200)
committerEric Bollengier <eric@baculasystems.com>
Thu, 29 Apr 2021 08:44:16 +0000 (10:44 +0200)
This commit is the result of the squash of the following main commits:

Author: Alain Spineux <alain@baculasystems.com>
Date:   Mon Jul 9 14:02:24 2018 +0200

    win32: make Win32Filter handle corrupted data

    - if data looks corrupted, then Win32Filter::have_data() skip the data up
      to the end of the input stream.
    - the error flag is set when the sizes in the header are <0

Author: Eric Bollengier <eric@baculasystems.com>
Date:   Thu Nov 5 16:25:37 2015 +0100

    Add win32filter class

bacula/src/findlib/win32filter.h

index dd098e39212508709e1a6fb38ad5a95ad403fa75..801a728eb48880359645d594c2f9f5ec347af77c 100644 (file)
@@ -25,7 +25,7 @@
 #include "bacula.h"
 
 /* this should physically correspond to WIN32_STREAM_ID
- * from winbase.h on Win32. We didn't inlcude cStreamName
+ * from winbase.h on Win32. We didn't include cStreamName
  * as we don't use it and don't need it for a correct struct size.
  */
 
@@ -41,6 +41,7 @@ typedef struct _BWIN32_STREAM_ID {
 class Win32Filter
 {
 public:
+   bool    error;       /* set when an error is detected */
    bool    initialized;
    int64_t skip_size;   /* how many bytes we have to skip before next header */
    int64_t data_size;   /* how many data are expected in the stream */
@@ -53,6 +54,7 @@ public:
    };
    
    void init() {
+      error = false;
       initialized = false;
       skip_size = 0;
       data_size = 0;