Package: netsed / 1.2-3

use_calloc.diff Patch series | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
Description: Build failure during test phase.
 When built against glibc version 2.23, the provided tests
 fail completely.  The cause turns out to be a segmentation
 fault in the rule interpreter.  The upstream code implicitly
 depends on a counter field being zeroed at return from malloc.
 Instead use calloc() for the large structures.
Bug-Debian: http://bugs.debian.org/818852
 http://bugs.debian.org/831270
Author: Mats Erik Andersson <mats.andersson@gisladisker.se>
Forwarded: yes
Last-Update: 2016-09-02

diff -Naup netsed-1.2.orig/netsed.c netsed-1.2/netsed.c
--- netsed-1.2.orig/netsed.c	2013-10-13 17:08:07.000000000 +0200
+++ netsed-1.2/netsed.c	2016-09-02 14:13:10.477993876 +0200
@@ -506,8 +506,8 @@ void parse_params(int argc,char* argv[])
   rport = argv[optind++];
 
   // allocate rule arrays, rule number is number of params after 5
-  rule=malloc((argc-optind)*sizeof(struct rule_s));
-  rule_live=malloc((argc-optind)*sizeof(int));
+  rule=calloc(argc-optind,sizeof(struct rule_s));
+  rule_live=calloc(argc-optind,sizeof(int));
   // parse rules
   for (i=optind;i<argc;i++) {
     char *fs=0, *ts=0, *cs=0;