From 1c7d6584a7811b7785ae5c1e378f14b5ba0971cf Mon Sep 17 00:00:00 2001 From: takeshi_hoshina Date: Mon, 2 Nov 2020 11:07:33 +0900 Subject: basesystem-jj recipes --- ...001-src-dir.c-fix-buffer-overflow-warning.patch | 41 ++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 external/poky/meta/recipes-devtools/make/make/0001-src-dir.c-fix-buffer-overflow-warning.patch (limited to 'external/poky/meta/recipes-devtools/make/make/0001-src-dir.c-fix-buffer-overflow-warning.patch') diff --git a/external/poky/meta/recipes-devtools/make/make/0001-src-dir.c-fix-buffer-overflow-warning.patch b/external/poky/meta/recipes-devtools/make/make/0001-src-dir.c-fix-buffer-overflow-warning.patch new file mode 100644 index 00000000..57970824 --- /dev/null +++ b/external/poky/meta/recipes-devtools/make/make/0001-src-dir.c-fix-buffer-overflow-warning.patch @@ -0,0 +1,41 @@ +From cd7091a7d88306004ca98c5dafcc40f44589b105 Mon Sep 17 00:00:00 2001 +From: Jens Rehsack +Date: Mon, 24 Feb 2020 10:52:21 +0100 +Subject: [PATCH 1/3] src/dir.c: fix buffer-overflow warning + +Fix compiler warning: + src/dir.c:1294:7: warning: 'strncpy' specified bound depends on the + length of the source argument [-Wstringop-overflow=] + +The existing code assumes `path` will never exceed `MAXPATHLEN`. Also the +size of the buffer is increased by 1 to hold a path with the length of +`MAXPATHLEN` and trailing `0`. + +Signed-off-by: Jens Rehsack +--- +Upstream-Status: Pending (https://savannah.gnu.org/bugs/?57888) + + src/dir.c | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +diff --git a/src/dir.c b/src/dir.c +index 862a18e..cad4c4a 100644 +--- a/src/dir.c ++++ b/src/dir.c +@@ -1289,10 +1289,10 @@ local_stat (const char *path, struct stat *buf) + if (plen > 1 && path[plen - 1] == '.' + && (path[plen - 2] == '/' || path[plen - 2] == '\\')) + { +- char parent[MAXPATHLEN]; ++ char parent[MAXPATHLEN+1]; + +- strncpy (parent, path, plen - 2); +- parent[plen - 2] = '\0'; ++ strncpy (parent, path, MAXPATHLEN); ++ parent[MIN(plen - 2, MAXPATHLEN)] = '\0'; + if (stat (parent, buf) < 0 || !_S_ISDIR (buf->st_mode)) + return -1; + } +-- +2.17.1 + -- cgit 1.2.3-korg