diff options
Diffstat (limited to 'meta/recipes-devtools/opkg')
-rw-r--r-- | meta/recipes-devtools/opkg/opkg/0001-file_util.c-fix-possible-bad-memory-access-in-file_r.patch | 50 | ||||
-rw-r--r-- | meta/recipes-devtools/opkg/opkg_0.4.2.bb | 6 |
2 files changed, 55 insertions, 1 deletions
diff --git a/meta/recipes-devtools/opkg/opkg/0001-file_util.c-fix-possible-bad-memory-access-in-file_r.patch b/meta/recipes-devtools/opkg/opkg/0001-file_util.c-fix-possible-bad-memory-access-in-file_r.patch new file mode 100644 index 0000000000..bec21e67f4 --- /dev/null +++ b/meta/recipes-devtools/opkg/opkg/0001-file_util.c-fix-possible-bad-memory-access-in-file_r.patch | |||
@@ -0,0 +1,50 @@ | |||
1 | From 8b45a3c4cab95382beea1ecdddeb2e4a9ed14aba Mon Sep 17 00:00:00 2001 | ||
2 | From: Jo-Philipp Wich <jo@mein.io> | ||
3 | Date: Wed, 1 Apr 2020 21:47:40 +0200 | ||
4 | Subject: [PATCH 001/104] file_util.c: fix possible bad memory access in | ||
5 | file_read_line_alloc() | ||
6 | |||
7 | In the case of a zero length string being returned by fgets(), the condition | ||
8 | checking for a trailing new line would perform a bad memory access outside | ||
9 | of `buf`. This might happen when line with a leading null byte is read. | ||
10 | |||
11 | Avoid this case by checking that the string has a length of at least one | ||
12 | byte. Also change the unsigned int types to size_t to store length values | ||
13 | while we're at it. | ||
14 | |||
15 | Upstream-Status: Backport [https://github.com/ndmsystems/opkg/commit/8b45a3c4cab95382beea1ecdddeb2e4a9ed14aba] | ||
16 | |||
17 | Signed-off-by: Jo-Philipp Wich <jo@mein.io> | ||
18 | Signed-off-by: Alejandro del Castillo <alejandro.delcastillo@ni.com> | ||
19 | Signed-off-by: virendra thakur <virendrak@kpit.com> | ||
20 | --- | ||
21 | libopkg/file_util.c | 7 ++----- | ||
22 | 1 file changed, 2 insertions(+), 5 deletions(-) | ||
23 | |||
24 | diff --git a/libopkg/file_util.c b/libopkg/file_util.c | ||
25 | index fbed7b4..ee9f59d 100644 | ||
26 | --- a/libopkg/file_util.c | ||
27 | +++ b/libopkg/file_util.c | ||
28 | @@ -127,17 +127,14 @@ char *file_readlink_alloc(const char *file_name) | ||
29 | */ | ||
30 | char *file_read_line_alloc(FILE * fp) | ||
31 | { | ||
32 | + size_t buf_len, line_size; | ||
33 | char buf[BUFSIZ]; | ||
34 | - unsigned int buf_len; | ||
35 | char *line = NULL; | ||
36 | - unsigned int line_size = 0; | ||
37 | int got_nl = 0; | ||
38 | |||
39 | - buf[0] = '\0'; | ||
40 | - | ||
41 | while (fgets(buf, BUFSIZ, fp)) { | ||
42 | buf_len = strlen(buf); | ||
43 | - if (buf[buf_len - 1] == '\n') { | ||
44 | + if (buf_len > 0 && buf[buf_len - 1] == '\n') { | ||
45 | buf_len--; | ||
46 | buf[buf_len] = '\0'; | ||
47 | got_nl = 1; | ||
48 | -- | ||
49 | 2.25.1 | ||
50 | |||
diff --git a/meta/recipes-devtools/opkg/opkg_0.4.2.bb b/meta/recipes-devtools/opkg/opkg_0.4.2.bb index 516982c6f5..3ebc27c8ee 100644 --- a/meta/recipes-devtools/opkg/opkg_0.4.2.bb +++ b/meta/recipes-devtools/opkg/opkg_0.4.2.bb | |||
@@ -2,6 +2,7 @@ SUMMARY = "Open Package Manager" | |||
2 | SUMMARY_libopkg = "Open Package Manager library" | 2 | SUMMARY_libopkg = "Open Package Manager library" |
3 | SECTION = "base" | 3 | SECTION = "base" |
4 | HOMEPAGE = "http://code.google.com/p/opkg/" | 4 | HOMEPAGE = "http://code.google.com/p/opkg/" |
5 | DESCRIPTION = "Opkg is a lightweight package management system based on Ipkg." | ||
5 | BUGTRACKER = "http://code.google.com/p/opkg/issues/list" | 6 | BUGTRACKER = "http://code.google.com/p/opkg/issues/list" |
6 | LICENSE = "GPLv2+" | 7 | LICENSE = "GPLv2+" |
7 | LIC_FILES_CHKSUM = "file://COPYING;md5=94d55d512a9ba36caa9b7df079bae19f \ | 8 | LIC_FILES_CHKSUM = "file://COPYING;md5=94d55d512a9ba36caa9b7df079bae19f \ |
@@ -15,6 +16,7 @@ SRC_URI = "http://downloads.yoctoproject.org/releases/${BPN}/${BPN}-${PV}.tar.gz | |||
15 | file://opkg.conf \ | 16 | file://opkg.conf \ |
16 | file://0001-opkg_conf-create-opkg.lock-in-run-instead-of-var-run.patch \ | 17 | file://0001-opkg_conf-create-opkg.lock-in-run-instead-of-var-run.patch \ |
17 | file://sourcedateepoch.patch \ | 18 | file://sourcedateepoch.patch \ |
19 | file://0001-file_util.c-fix-possible-bad-memory-access-in-file_r.patch \ | ||
18 | file://run-ptest \ | 20 | file://run-ptest \ |
19 | " | 21 | " |
20 | 22 | ||
@@ -49,7 +51,9 @@ EXTRA_OECONF_class-native = "--localstatedir=/${@os.path.relpath('${localstatedi | |||
49 | do_install_append () { | 51 | do_install_append () { |
50 | install -d ${D}${sysconfdir}/opkg | 52 | install -d ${D}${sysconfdir}/opkg |
51 | install -m 0644 ${WORKDIR}/opkg.conf ${D}${sysconfdir}/opkg/opkg.conf | 53 | install -m 0644 ${WORKDIR}/opkg.conf ${D}${sysconfdir}/opkg/opkg.conf |
52 | echo "option lists_dir ${OPKGLIBDIR}/opkg/lists" >>${D}${sysconfdir}/opkg/opkg.conf | 54 | echo "option lists_dir ${OPKGLIBDIR}/opkg/lists" >>${D}${sysconfdir}/opkg/opkg.conf |
55 | echo "option info_dir ${OPKGLIBDIR}/opkg/info" >>${D}${sysconfdir}/opkg/opkg.conf | ||
56 | echo "option status_file ${OPKGLIBDIR}/opkg/status" >>${D}${sysconfdir}/opkg/opkg.conf | ||
53 | 57 | ||
54 | # We need to create the lock directory | 58 | # We need to create the lock directory |
55 | install -d ${D}${OPKGLIBDIR}/opkg | 59 | install -d ${D}${OPKGLIBDIR}/opkg |