diff options
author | Khem Raj <raj.khem@gmail.com> | 2021-02-27 14:14:11 -0800 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2021-03-01 11:12:16 +0000 |
commit | 671beb4de74de732ef707c15748c7d24d4651ad7 (patch) | |
tree | acca94bd84ff2966c3571c0fd7dd1f41ca5e0457 /meta | |
parent | e7dc30cefd8d408cbd8730ab4efde5bf8b681bb1 (diff) | |
download | poky-671beb4de74de732ef707c15748c7d24d4651ad7.tar.gz |
puzzles: Fix stringop-overflow warning
gcc11 is pedantic about it and finds a case where this
maybe used uninitialized
(From OE-Core rev: 06f298e6d1777093b61baef3873813a809b010bd)
Signed-off-by: Khem Raj <raj.khem@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta')
-rw-r--r-- | meta/recipes-sato/puzzles/files/0001-map-Fix-stringop-overflow-warning.patch | 42 | ||||
-rw-r--r-- | meta/recipes-sato/puzzles/puzzles_git.bb | 1 |
2 files changed, 43 insertions, 0 deletions
diff --git a/meta/recipes-sato/puzzles/files/0001-map-Fix-stringop-overflow-warning.patch b/meta/recipes-sato/puzzles/files/0001-map-Fix-stringop-overflow-warning.patch new file mode 100644 index 0000000000..a02d8732ab --- /dev/null +++ b/meta/recipes-sato/puzzles/files/0001-map-Fix-stringop-overflow-warning.patch | |||
@@ -0,0 +1,42 @@ | |||
1 | From 3d78d4cffcdc1242892b6c21c26d1c96938c48d1 Mon Sep 17 00:00:00 2001 | ||
2 | From: Khem Raj <raj.khem@gmail.com> | ||
3 | Date: Sat, 27 Feb 2021 10:02:43 -0800 | ||
4 | Subject: [PATCH] map: Fix stringop-overflow warning | ||
5 | |||
6 | Fixes | ||
7 | |||
8 | ../git/map.c: In function 'new_game_desc': | ||
9 | ../git/map.c:1663:23: error: writing 1 byte into a region of size 0 [-Werror=stringop-overflow=] | ||
10 | 1663 | ret[retlen++] = ','; | ||
11 | | ~~~~~~~~~~~~~~^~~~~ | ||
12 | ../git/./map.c: In function 'new_game_desc': | ||
13 | ../git/./map.c:1663:23: error: writing 1 byte into a region of size 0 [-Werror=stringop-overflow=] | ||
14 | 1663 | ret[retlen++] = ','; | ||
15 | | ~~~~~~~~~~~~~~^~~~~ | ||
16 | |||
17 | Upstream-Status: Pending | ||
18 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | ||
19 | --- | ||
20 | map.c | 6 ++++-- | ||
21 | 1 file changed, 4 insertions(+), 2 deletions(-) | ||
22 | |||
23 | diff --git a/map.c b/map.c | ||
24 | index 412305c..fa0c493 100644 | ||
25 | --- a/map.c | ||
26 | +++ b/map.c | ||
27 | @@ -1659,8 +1659,10 @@ static char *new_game_desc(const game_params *params, random_state *rs, | ||
28 | } | ||
29 | } | ||
30 | |||
31 | - ret[retlen++] = 'a'-1 + run; | ||
32 | - ret[retlen++] = ','; | ||
33 | + if(ret != NULL) { | ||
34 | + ret[retlen++] = 'a'-1 + run; | ||
35 | + ret[retlen++] = ','; | ||
36 | + } | ||
37 | |||
38 | run = 0; | ||
39 | for (i = 0; i < n; i++) { | ||
40 | -- | ||
41 | 2.30.1 | ||
42 | |||
diff --git a/meta/recipes-sato/puzzles/puzzles_git.bb b/meta/recipes-sato/puzzles/puzzles_git.bb index 5b65cf8655..ecc2b9844d 100644 --- a/meta/recipes-sato/puzzles/puzzles_git.bb +++ b/meta/recipes-sato/puzzles/puzzles_git.bb | |||
@@ -15,6 +15,7 @@ SRC_URI = "git://git.tartarus.org/simon/puzzles.git \ | |||
15 | file://0001-pattern.c-Change-string-lenght-parameter-to-be-size_.patch \ | 15 | file://0001-pattern.c-Change-string-lenght-parameter-to-be-size_.patch \ |
16 | file://fix-ki-uninitialized.patch \ | 16 | file://fix-ki-uninitialized.patch \ |
17 | file://0001-malloc-Check-for-excessive-values-to-malloc.patch \ | 17 | file://0001-malloc-Check-for-excessive-values-to-malloc.patch \ |
18 | file://0001-map-Fix-stringop-overflow-warning.patch \ | ||
18 | " | 19 | " |
19 | 20 | ||
20 | UPSTREAM_CHECK_COMMITS = "1" | 21 | UPSTREAM_CHECK_COMMITS = "1" |