summaryrefslogtreecommitdiffstats
path: root/meta/recipes-core/glibc/glibc/0029-fix-getmntent-empty-lines.patch
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-core/glibc/glibc/0029-fix-getmntent-empty-lines.patch')
-rw-r--r--meta/recipes-core/glibc/glibc/0029-fix-getmntent-empty-lines.patch40
1 files changed, 0 insertions, 40 deletions
diff --git a/meta/recipes-core/glibc/glibc/0029-fix-getmntent-empty-lines.patch b/meta/recipes-core/glibc/glibc/0029-fix-getmntent-empty-lines.patch
deleted file mode 100644
index 390bb3034d..0000000000
--- a/meta/recipes-core/glibc/glibc/0029-fix-getmntent-empty-lines.patch
+++ /dev/null
@@ -1,40 +0,0 @@
1From b0e805fa0d6fea33745952df7b7f5442ca4c374f Mon Sep 17 00:00:00 2001
2From: Mike Frysinger <vapier@gentoo.org>
3Date: Fri, 28 Aug 2015 17:08:49 -0400
4Subject: [PATCH] getmntent: fix memory corruption w/blank lines [BZ #18887]
5
6The fix for BZ #17273 introduced a single byte of memory corruption when
7the line is entirely blank. It would walk back past the start of the
8buffer if the heap happened to be 0x20 or 0x09 and then write a NUL byte.
9 buffer = '\n';
10 end_ptr = buffer;
11 while (end_ptr[-1] == ' ' || end_ptr[-1] == '\t')
12 end_ptr--;
13 *end_ptr = '\0';
14
15Fix that and rework the tests. Adding the testcase for BZ #17273 to the
16existing \040 parser does not really make sense as it's unrelated, and
17leads to confusing behavior: it implicitly relies on the new entry being
18longer than the previous entry (since it just rewinds the FILE*). Split
19it out into its own dedicated testcase instead.
20
21The original patch is at link https://sourceware.org/git/gitweb.cgi?p=glibc.git;a=patch;h=b0e805fa0d6fea33745952df7b7f5442ca4c374f.
22Only code to mntent_r.c is kept in this patch, Change log, NEWS, Makefile, and test cases are excluded.
23
24Upstream-Status: Backport (upstreamed to 2.23)
25Signed-off-by: Baoshan Pang <baoshan.pang@windriver.com>
26
27diff --git a/misc/mntent_r.c b/misc/mntent_r.c
28index 6159873..19af8a8 100644
29--- a/misc/mntent_r.c
30+++ b/misc/mntent_r.c
31@@ -136,7 +136,8 @@ __getmntent_r (FILE *stream, struct mntent *mp, char *buffer, int bufsiz)
32 end_ptr = strchr (buffer, '\n');
33 if (end_ptr != NULL) /* chop newline */
34 {
35- while (end_ptr[-1] == ' ' || end_ptr[-1] == '\t')
36+ while (end_ptr != buffer
37+ && (end_ptr[-1] == ' ' || end_ptr[-1] == '\t'))
38 end_ptr--;
39 *end_ptr = '\0';
40 }