Fix string truncation warnings
PeterB
1 year, 9 months ago
0 | Description: Fix stringop-truncation warnings | |
1 | Author: Peter Blackman <peter@pblackman.plus.com> | |
2 | Forwarded: No | |
3 | ||
4 | Index: b/flam3-genome.c | |
5 | =================================================================== | |
6 | --- a/flam3-genome.c | |
7 | +++ b/flam3-genome.c | |
8 | @@ -977,7 +977,7 @@ | |
9 | ||
10 | if (cp_orig.flame_name[0]) { | |
11 | char tm[flam3_name_len+1]; | |
12 | - strncpy(tm, cp_orig.flame_name, flam3_name_len); | |
13 | + strncpy(tm, cp_orig.flame_name, flam3_name_len+1); | |
14 | snprintf(cp_orig.flame_name, flam3_name_len, "mutation %d of %s", rep, tm); | |
15 | } | |
16 | ||
17 | Index: b/flam3.c | |
18 | =================================================================== | |
19 | --- a/flam3.c | |
20 | +++ b/flam3.c | |
21 | @@ -2508,7 +2508,7 @@ | |
22 | f->rc.randrsl[lp] = default_isaac_seed; | |
23 | } else { | |
24 | /* Use the specified string */ | |
25 | - strncpy((char *)&f->rc.randrsl,(const char *)isaac_seed, RANDSIZ*sizeof(ub4)); | |
26 | + strncpy((char *)&f->rc.randrsl,(const char *)isaac_seed, RANDSIZ*sizeof(ub4)-1); | |
27 | } | |
28 | ||
29 | /* Initialize the random number generator */ |