summaryrefslogtreecommitdiffstats
path: root/meta/recipes-sato/puzzles/files/0001-map-Fix-stringop-overflow-warning.patch
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-sato/puzzles/files/0001-map-Fix-stringop-overflow-warning.patch')
-rw-r--r--meta/recipes-sato/puzzles/files/0001-map-Fix-stringop-overflow-warning.patch38
1 files changed, 15 insertions, 23 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
index a02d8732ab..7f46d3ec0e 100644
--- 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
@@ -1,7 +1,5 @@
1From 3d78d4cffcdc1242892b6c21c26d1c96938c48d1 Mon Sep 17 00:00:00 2001
2From: Khem Raj <raj.khem@gmail.com> 1From: Khem Raj <raj.khem@gmail.com>
3Date: Sat, 27 Feb 2021 10:02:43 -0800 2map: Fix stringop-overflow warning
4Subject: [PATCH] map: Fix stringop-overflow warning
5 3
6Fixes 4Fixes
7 5
@@ -14,29 +12,23 @@ Fixes
14 1663 | ret[retlen++] = ','; 12 1663 | ret[retlen++] = ',';
15 | ~~~~~~~~~~~~~~^~~~~ 13 | ~~~~~~~~~~~~~~^~~~~
16 14
17Upstream-Status: Pending 15Upstream-Status: Submitted [email discussion with upstream]
16
17Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
18Signed-off-by: Khem Raj <raj.khem@gmail.com> 18Signed-off-by: Khem Raj <raj.khem@gmail.com>
19---
20 map.c | 6 ++++--
21 1 file changed, 4 insertions(+), 2 deletions(-)
22 19
23diff --git a/map.c b/map.c 20Index: git/map.c
24index 412305c..fa0c493 100644 21===================================================================
25--- a/map.c 22--- git.orig/map.c
26+++ b/map.c 23+++ git/map.c
27@@ -1659,8 +1659,10 @@ static char *new_game_desc(const game_params *params, random_state *rs, 24@@ -1659,6 +1659,10 @@ static char *new_game_desc(const game_pa
28 } 25 }
29 } 26 }
30 27
31- ret[retlen++] = 'a'-1 + run; 28+ if (retlen + 10 >= retsize) {
32- ret[retlen++] = ','; 29+ retsize = retlen + 256;
33+ if(ret != NULL) { 30+ ret = sresize(ret, retsize, char);
34+ ret[retlen++] = 'a'-1 + run; 31+ }
35+ ret[retlen++] = ','; 32 ret[retlen++] = 'a'-1 + run;
36+ } 33 ret[retlen++] = ',';
37 34
38 run = 0;
39 for (i = 0; i < n; i++) {
40--
412.30.1
42