File bacula-2.4.2-fortify.diff of Package bacula
--- src/console/console_conf.c
+++ src/console/console_conf.c
@@ -74,7 +74,12 @@
#else
URES res_all;
#endif
-int res_all_size = sizeof(res_all);
+
+void
+res_all_memset(void* s, int i)
+{
+ memset(s,i,sizeof(res_all));
+}
/* Definition of records permitted within each
* resource with the routine to process the record
--- src/dird/dird_conf.c
+++ src/dird/dird_conf.c
@@ -93,8 +93,12 @@
#else
URES res_all;
#endif
-int res_all_size = sizeof(res_all);
+void
+res_all_memset(void* s, int i)
+{
+ memset(s,i,sizeof(res_all));
+}
/* Definition of records permitted within each
* resource with the routine to process the record
--- src/dird/inc_conf.c
+++ src/dird/inc_conf.c
@@ -72,7 +72,6 @@
#else
extern URES res_all;
#endif
-extern int res_all_size;
/* We build the current new Include and Exclude items here */
static INCEXE res_incexe;
--- src/filed/filed_conf.c
+++ src/filed/filed_conf.c
@@ -77,7 +77,12 @@
#else
URES res_all;
#endif
-int res_all_size = sizeof(res_all);
+
+void
+res_all_memset(void* s, int i)
+{
+ memset(s,i,sizeof(res_all));
+}
/* Definition of records permitted within each
* resource with the routine to process the record
--- src/gnome2-console/console_conf.c
+++ src/gnome2-console/console_conf.c
@@ -70,7 +70,12 @@
* scan is complete.
*/
URES res_all;
-int res_all_size = sizeof(res_all);
+
+void
+res_all_memset(void* s, int i)
+{
+ memset(s,i,sizeof(res_all));
+}
/* Definition of records permitted within each
* resource with the routine to process the record
--- src/lib/parse_conf.c
+++ src/lib/parse_conf.c
@@ -93,7 +93,6 @@
#else
extern URES res_all;
#endif
-extern int res_all_size;
extern brwlock_t res_lock; /* resource lock */
@@ -201,7 +200,7 @@
int i;
int rindex = type - r_first;
- memset(&res_all, 0, res_all_size);
+ res_all_memset(&res_all, 0);
res_all.hdr.rcode = type;
res_all.hdr.refcnt = 1;
--- src/lib/parse_conf.h
+++ src/lib/parse_conf.h
@@ -163,3 +163,5 @@
void store_size(LEX *lc, RES_ITEM *item, int index, int pass);
void store_defs(LEX *lc, RES_ITEM *item, int index, int pass);
void store_label(LEX *lc, RES_ITEM *item, int index, int pass);
+
+void res_all_memset(void* s, int i);;
--- src/qt-console/bat_conf.cpp
+++ src/qt-console/bat_conf.cpp
@@ -70,7 +70,12 @@
* scan is complete.
*/
URES res_all;
-int res_all_size = sizeof(res_all);
+
+void
+res_all_memset(void* s, int i)
+{
+ memset(s,i,sizeof(res_all));
+}
/* Definition of records permitted within each
* resource with the routine to process the record
--- src/stored/stored_conf.c
+++ src/stored/stored_conf.c
@@ -56,7 +56,12 @@
#else
URES res_all;
#endif
-int res_all_size = sizeof(res_all);
+
+void
+res_all_memset(void* s, int i)
+{
+ memset(s,i,sizeof(res_all));
+}
/* Definition of records permitted within each
* resource with the routine to process the record
--- src/tray-monitor/tray_conf.c
+++ src/tray-monitor/tray_conf.c
@@ -67,8 +67,12 @@
* scan is complete.
*/
URES res_all;
-int res_all_size = sizeof(res_all);
+void
+res_all_memset(void* s, int i)
+{
+ memset(s,i,sizeof(res_all));
+}
/* Definition of records permitted within each
* resource with the routine to process the record
--- src/wx-console/console_conf.c
+++ src/wx-console/console_conf.c
@@ -86,7 +86,12 @@
#else
URES res_all;
#endif
-int res_all_size = sizeof(res_all);
+
+void
+res_all_memset(void* s, int i)
+{
+ memset(s,i,sizeof(res_all));
+}
/* Definition of records permitted within each
* resource with the routine to process the record