File: 008-stringop-truncation.patch

package info (click to toggle)
flam3 3.1.1%2Bds2-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 2,736 kB
  • sloc: xml: 23,135; ansic: 19,319; makefile: 66; sh: 21
file content (30 lines) | stat: -rw-r--r-- 1,104 bytes parent folder | 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
27
28
29
30
Description: Fix stringop-truncation warnings
Author: Peter Blackman <peter@pblackman.plus.com>
Forwarded: not-needed

Index: b/flam3-genome.c
===================================================================
--- a/flam3-genome.c
+++ b/flam3-genome.c
@@ -977,7 +977,7 @@
                   
                if (cp_orig.flame_name[0]) {
                   char tm[flam3_name_len+1];
-                  strncpy(tm, cp_orig.flame_name, flam3_name_len);
+                  strncpy(tm, cp_orig.flame_name, flam3_name_len+1);
                   snprintf(cp_orig.flame_name, flam3_name_len, "mutation %d of %s", rep, tm);
                }
 
Index: b/flam3.c
===================================================================
--- a/flam3.c
+++ b/flam3.c
@@ -2508,7 +2508,7 @@
          f->rc.randrsl[lp] = default_isaac_seed;
    } else {
       /* Use the specified string */
-      strncpy((char *)&f->rc.randrsl,(const char *)isaac_seed, RANDSIZ*sizeof(ub4));
+      strncpy((char *)&f->rc.randrsl,(const char *)isaac_seed, RANDSIZ*sizeof(ub4)-1);
    }
 
    /* Initialize the random number generator */