diff options
author | Natanael Copa <ncopa@alpinelinux.org> | 2016-09-14 12:38:58 +0200 |
---|---|---|
committer | Natanael Copa <ncopa@alpinelinux.org> | 2016-09-22 16:39:52 +0200 |
commit | ae8d3cf9388fd0a3f387bfbab1e1fe8cbfab9489 (patch) | |
tree | 8b4830efef79e3414db883d1747922d8121a8905 | |
parent | a38f0ddf93adc4fd2f8255cbd1c94ab704b007ac (diff) | |
download | alpine_aports-ae8d3cf9388fd0a3f387bfbab1e1fe8cbfab9489.tar.bz2 alpine_aports-ae8d3cf9388fd0a3f387bfbab1e1fe8cbfab9489.tar.xz alpine_aports-ae8d3cf9388fd0a3f387bfbab1e1fe8cbfab9489.zip |
main/musl: fix for getmntent
fixes #5703
-rw-r--r-- | main/musl/0001-use-dynamic-buffer-for-getmntent.patch | 66 | ||||
-rw-r--r-- | main/musl/APKBUILD | 6 |
2 files changed, 71 insertions, 1 deletions
diff --git a/main/musl/0001-use-dynamic-buffer-for-getmntent.patch b/main/musl/0001-use-dynamic-buffer-for-getmntent.patch new file mode 100644 index 0000000000..12feaa8266 --- /dev/null +++ b/main/musl/0001-use-dynamic-buffer-for-getmntent.patch | |||
@@ -0,0 +1,66 @@ | |||
1 | From c0dd2db34a8a5d51699406a90a4f87cb3129d5a1 Mon Sep 17 00:00:00 2001 | ||
2 | From: Natanael Copa <ncopa@alpinelinux.org> | ||
3 | Date: Thu, 8 Sep 2016 09:06:22 +0200 | ||
4 | Subject: [PATCH] use dynamic buffer for getmntent | ||
5 | |||
6 | overlayfs may have fairly long lines so we use getline to allocate a | ||
7 | buffer dynamically. The buffer will be allocated on first use, expand as | ||
8 | needed, but will never be free'ed. | ||
9 | |||
10 | Downstream bug: http://bugs.alpinelinux.org/issues/5703 | ||
11 | |||
12 | Signed-off-by: Natanael Copa <ncopa@alpinelinux.org> | ||
13 | --- | ||
14 | src/misc/mntent.c | 16 ++++++++++++---- | ||
15 | 1 file changed, 12 insertions(+), 4 deletions(-) | ||
16 | |||
17 | diff --git a/src/misc/mntent.c b/src/misc/mntent.c | ||
18 | index a16d652..722a030 100644 | ||
19 | --- a/src/misc/mntent.c | ||
20 | +++ b/src/misc/mntent.c | ||
21 | @@ -3,6 +3,11 @@ | ||
22 | #include <mntent.h> | ||
23 | #include <errno.h> | ||
24 | |||
25 | +static char *internal_buf = NULL; | ||
26 | +static size_t internal_bufsize = 0; | ||
27 | + | ||
28 | +#define SENTINEL (char *)&internal_buf | ||
29 | + | ||
30 | FILE *setmntent(const char *name, const char *mode) | ||
31 | { | ||
32 | return fopen(name, mode); | ||
33 | @@ -16,13 +21,17 @@ int endmntent(FILE *f) | ||
34 | |||
35 | struct mntent *getmntent_r(FILE *f, struct mntent *mnt, char *linebuf, int buflen) | ||
36 | { | ||
37 | - int cnt, n[8]; | ||
38 | + int cnt, n[8], use_internal = (linebuf == SENTINEL); | ||
39 | |||
40 | mnt->mnt_freq = 0; | ||
41 | mnt->mnt_passno = 0; | ||
42 | |||
43 | do { | ||
44 | - fgets(linebuf, buflen, f); | ||
45 | + if (use_internal) { | ||
46 | + getline(&internal_buf, &internal_bufsize, f); | ||
47 | + linebuf = internal_buf; | ||
48 | + } else | ||
49 | + fgets(linebuf, buflen, f); | ||
50 | if (feof(f) || ferror(f)) return 0; | ||
51 | if (!strchr(linebuf, '\n')) { | ||
52 | fscanf(f, "%*[^\n]%*[\n]"); | ||
53 | @@ -49,9 +58,8 @@ struct mntent *getmntent_r(FILE *f, struct mntent *mnt, char *linebuf, int bufle | ||
54 | |||
55 | struct mntent *getmntent(FILE *f) | ||
56 | { | ||
57 | - static char linebuf[256]; | ||
58 | static struct mntent mnt; | ||
59 | - return getmntent_r(f, &mnt, linebuf, sizeof linebuf); | ||
60 | + return getmntent_r(f, &mnt, SENTINEL, 0); | ||
61 | } | ||
62 | |||
63 | int addmntent(FILE *f, const struct mntent *mnt) | ||
64 | -- | ||
65 | 2.10.0 | ||
66 | |||
diff --git a/main/musl/APKBUILD b/main/musl/APKBUILD index e010239e6d..02c68e4832 100644 --- a/main/musl/APKBUILD +++ b/main/musl/APKBUILD | |||
@@ -2,7 +2,7 @@ | |||
2 | # Maintainer: Timo Teräs <timo.teras@iki.fi> | 2 | # Maintainer: Timo Teräs <timo.teras@iki.fi> |
3 | pkgname=musl | 3 | pkgname=musl |
4 | pkgver=1.1.14 | 4 | pkgver=1.1.14 |
5 | pkgrel=11 | 5 | pkgrel=12 |
6 | pkgdesc="the musl c library (libc) implementation" | 6 | pkgdesc="the musl c library (libc) implementation" |
7 | url="http://www.musl-libc.org/" | 7 | url="http://www.musl-libc.org/" |
8 | arch="all" | 8 | arch="all" |
@@ -33,6 +33,7 @@ source="http://www.musl-libc.org/releases/musl-$pkgver.tar.gz | |||
33 | 0019-fix-misordered-syscall-arguments-for-posix_fadvise-o.patch | 33 | 0019-fix-misordered-syscall-arguments-for-posix_fadvise-o.patch |
34 | 0020-improve-abort-fallback-behavior-when-raising-SIGABRT.patch | 34 | 0020-improve-abort-fallback-behavior-when-raising-SIGABRT.patch |
35 | 0021-fix-asctime-day-month-names-not-to-vary-by-locale.patch | 35 | 0021-fix-asctime-day-month-names-not-to-vary-by-locale.patch |
36 | 0001-use-dynamic-buffer-for-getmntent.patch | ||
36 | 37 | ||
37 | ldconfig | 38 | ldconfig |
38 | __stack_chk_fail_local.c | 39 | __stack_chk_fail_local.c |
@@ -161,6 +162,7 @@ f34ce9786c13ae945a4dff0c6f3436af 0018-in-performing-dns-lookups-check-result-fr | |||
161 | 1220568cdbac3e61faf6d6104029aefb 0019-fix-misordered-syscall-arguments-for-posix_fadvise-o.patch | 162 | 1220568cdbac3e61faf6d6104029aefb 0019-fix-misordered-syscall-arguments-for-posix_fadvise-o.patch |
162 | 252d72f8100f0661e7f335da4ac195e6 0020-improve-abort-fallback-behavior-when-raising-SIGABRT.patch | 163 | 252d72f8100f0661e7f335da4ac195e6 0020-improve-abort-fallback-behavior-when-raising-SIGABRT.patch |
163 | c08825383e41e5dbcd3ffdfd2062dd47 0021-fix-asctime-day-month-names-not-to-vary-by-locale.patch | 164 | c08825383e41e5dbcd3ffdfd2062dd47 0021-fix-asctime-day-month-names-not-to-vary-by-locale.patch |
165 | c6b8732eea4642112c56f45ff00e356a 0001-use-dynamic-buffer-for-getmntent.patch | ||
164 | 830d01f7821b978df770b06db3790921 ldconfig | 166 | 830d01f7821b978df770b06db3790921 ldconfig |
165 | 0df687757221bbb0fc1aa67f1bd646f9 __stack_chk_fail_local.c | 167 | 0df687757221bbb0fc1aa67f1bd646f9 __stack_chk_fail_local.c |
166 | 57ef2c63b9ec6a2041694ace97d4ffa2 getconf.c | 168 | 57ef2c63b9ec6a2041694ace97d4ffa2 getconf.c |
@@ -188,6 +190,7 @@ da4935744d9d6b60f06a9e6af9badd3c239d13cba204c9a10007b23fd10d6275 0017-fix-misal | |||
188 | 54454457d7e25e01624a2ebd96b01d8c53448e410f69106d3d62bafacfddcc48 0019-fix-misordered-syscall-arguments-for-posix_fadvise-o.patch | 190 | 54454457d7e25e01624a2ebd96b01d8c53448e410f69106d3d62bafacfddcc48 0019-fix-misordered-syscall-arguments-for-posix_fadvise-o.patch |
189 | 03c776222b65ab374c8659d61f905a9618c460994d70bb9b80655ba6a668c1d4 0020-improve-abort-fallback-behavior-when-raising-SIGABRT.patch | 191 | 03c776222b65ab374c8659d61f905a9618c460994d70bb9b80655ba6a668c1d4 0020-improve-abort-fallback-behavior-when-raising-SIGABRT.patch |
190 | d157100aeed5b0866eb6d50288f63f26ea9900f1d4c7b8a1492294c912b5cc19 0021-fix-asctime-day-month-names-not-to-vary-by-locale.patch | 192 | d157100aeed5b0866eb6d50288f63f26ea9900f1d4c7b8a1492294c912b5cc19 0021-fix-asctime-day-month-names-not-to-vary-by-locale.patch |
193 | e1671e2436954f2eec0d2f49dd53e9e66ff0106c9c017a7ff69d35bdb7051055 0001-use-dynamic-buffer-for-getmntent.patch | ||
191 | b4a2c06db38742e8c42c3c9838b285a7d8cdac6c091ff3df5ff9a15f1e41b9c7 ldconfig | 194 | b4a2c06db38742e8c42c3c9838b285a7d8cdac6c091ff3df5ff9a15f1e41b9c7 ldconfig |
192 | 299a7d75a09de3e2e11e7fb4acc3182e4a14e868093d2f30938fce9bfcff13da __stack_chk_fail_local.c | 195 | 299a7d75a09de3e2e11e7fb4acc3182e4a14e868093d2f30938fce9bfcff13da __stack_chk_fail_local.c |
193 | d87d0cbb3690ae2c5d8cc218349fd8278b93855dd625deaf7ae50e320aad247c getconf.c | 196 | d87d0cbb3690ae2c5d8cc218349fd8278b93855dd625deaf7ae50e320aad247c getconf.c |
@@ -215,6 +218,7 @@ a497943a0bc3752027467e21988e402eeab9ad2a7f37bc43cdbd05f6b45677e9cc72a200143f0b4f | |||
215 | 99857974627729664d0f4c3427e0d5e8843a07deb77c7ef7381e060eacb629fab926ab18d966a1d55ab4b032ef812363e74d549c03941c0982bd950e27294a18 0019-fix-misordered-syscall-arguments-for-posix_fadvise-o.patch | 218 | 99857974627729664d0f4c3427e0d5e8843a07deb77c7ef7381e060eacb629fab926ab18d966a1d55ab4b032ef812363e74d549c03941c0982bd950e27294a18 0019-fix-misordered-syscall-arguments-for-posix_fadvise-o.patch |
216 | b8c50dbb33fa9cd8ae40b97f9662bedfc6fce4272e1e34b11daf14847b99e9a2bdc2dd9916329c0a407945e21d0070e8306e3ed2d1f857fc83ca64d430e4623a 0020-improve-abort-fallback-behavior-when-raising-SIGABRT.patch | 219 | b8c50dbb33fa9cd8ae40b97f9662bedfc6fce4272e1e34b11daf14847b99e9a2bdc2dd9916329c0a407945e21d0070e8306e3ed2d1f857fc83ca64d430e4623a 0020-improve-abort-fallback-behavior-when-raising-SIGABRT.patch |
217 | 1a74d5f5e0f6f2fe6029ed0f18b4603f80c990f19aa13d83c5d1f40f032b2ffb3819aae13ae1f96415bb08571774eec164e71d09028f2a5db4ae9b77e48cafe7 0021-fix-asctime-day-month-names-not-to-vary-by-locale.patch | 220 | 1a74d5f5e0f6f2fe6029ed0f18b4603f80c990f19aa13d83c5d1f40f032b2ffb3819aae13ae1f96415bb08571774eec164e71d09028f2a5db4ae9b77e48cafe7 0021-fix-asctime-day-month-names-not-to-vary-by-locale.patch |
221 | a25ff6c640fed110c124f2b12920111befa832202b906649e1d21613dda32b55bada0d59b310f4af2d4ae27c9ce2c92079ba1c919b4898c002f271c7a0c04878 0001-use-dynamic-buffer-for-getmntent.patch | ||
218 | 8d3a2d5315fc56fee7da9abb8b89bb38c6046c33d154c10d168fb35bfde6b0cf9f13042a3bceee34daf091bc409d699223735dcf19f382eeee1f6be34154f26f ldconfig | 222 | 8d3a2d5315fc56fee7da9abb8b89bb38c6046c33d154c10d168fb35bfde6b0cf9f13042a3bceee34daf091bc409d699223735dcf19f382eeee1f6be34154f26f ldconfig |
219 | 062bb49fa54839010acd4af113e20f7263dde1c8a2ca359b5fb2661ef9ed9d84a0f7c3bc10c25dcfa10bb3c5a4874588dff636ac43d5dbb3d748d75400756d0b __stack_chk_fail_local.c | 223 | 062bb49fa54839010acd4af113e20f7263dde1c8a2ca359b5fb2661ef9ed9d84a0f7c3bc10c25dcfa10bb3c5a4874588dff636ac43d5dbb3d748d75400756d0b __stack_chk_fail_local.c |
220 | 0d80f37b34a35e3d14b012257c50862dfeb9d2c81139ea2dfa101d981d093b009b9fa450ba27a708ac59377a48626971dfc58e20a3799084a65777a0c32cbc7d getconf.c | 224 | 0d80f37b34a35e3d14b012257c50862dfeb9d2c81139ea2dfa101d981d093b009b9fa450ba27a708ac59377a48626971dfc58e20a3799084a65777a0c32cbc7d getconf.c |