aboutsummaryrefslogtreecommitdiffstats
path: root/main/musl
diff options
context:
space:
mode:
authorNatanael Copa <ncopa@alpinelinux.org>2016-09-14 12:38:58 +0200
committerNatanael Copa <ncopa@alpinelinux.org>2016-09-14 12:40:09 +0200
commit6a2b1e8bc87aca9f100a08c15335246a1744b1fd (patch)
tree2958e85373b0c41951bd5bc92322b84d742cba37 /main/musl
parenta5f4ba336e4638637bdbf06c5c64fb7c936adc58 (diff)
downloadaports-6a2b1e8bc87aca9f100a08c15335246a1744b1fd.tar.bz2
aports-6a2b1e8bc87aca9f100a08c15335246a1744b1fd.tar.xz
main/musl: fix for getmntent
ref #5703
Diffstat (limited to 'main/musl')
-rw-r--r--main/musl/0001-use-dynamic-buffer-for-getmntent.patch66
-rw-r--r--main/musl/APKBUILD6
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 @@
+From c0dd2db34a8a5d51699406a90a4f87cb3129d5a1 Mon Sep 17 00:00:00 2001
+From: Natanael Copa <ncopa@alpinelinux.org>
+Date: Thu, 8 Sep 2016 09:06:22 +0200
+Subject: [PATCH] use dynamic buffer for getmntent
+
+overlayfs may have fairly long lines so we use getline to allocate a
+buffer dynamically. The buffer will be allocated on first use, expand as
+needed, but will never be free'ed.
+
+Downstream bug: http://bugs.alpinelinux.org/issues/5703
+
+Signed-off-by: Natanael Copa <ncopa@alpinelinux.org>
+---
+ src/misc/mntent.c | 16 ++++++++++++----
+ 1 file changed, 12 insertions(+), 4 deletions(-)
+
+diff --git a/src/misc/mntent.c b/src/misc/mntent.c
+index a16d652..722a030 100644
+--- a/src/misc/mntent.c
++++ b/src/misc/mntent.c
+@@ -3,6 +3,11 @@
+ #include <mntent.h>
+ #include <errno.h>
+
++static char *internal_buf = NULL;
++static size_t internal_bufsize = 0;
++
++#define SENTINEL (char *)&internal_buf
++
+ FILE *setmntent(const char *name, const char *mode)
+ {
+ return fopen(name, mode);
+@@ -16,13 +21,17 @@ int endmntent(FILE *f)
+
+ struct mntent *getmntent_r(FILE *f, struct mntent *mnt, char *linebuf, int buflen)
+ {
+- int cnt, n[8];
++ int cnt, n[8], use_internal = (linebuf == SENTINEL);
+
+ mnt->mnt_freq = 0;
+ mnt->mnt_passno = 0;
+
+ do {
+- fgets(linebuf, buflen, f);
++ if (use_internal) {
++ getline(&internal_buf, &internal_bufsize, f);
++ linebuf = internal_buf;
++ } else
++ fgets(linebuf, buflen, f);
+ if (feof(f) || ferror(f)) return 0;
+ if (!strchr(linebuf, '\n')) {
+ fscanf(f, "%*[^\n]%*[\n]");
+@@ -49,9 +58,8 @@ struct mntent *getmntent_r(FILE *f, struct mntent *mnt, char *linebuf, int bufle
+
+ struct mntent *getmntent(FILE *f)
+ {
+- static char linebuf[256];
+ static struct mntent mnt;
+- return getmntent_r(f, &mnt, linebuf, sizeof linebuf);
++ return getmntent_r(f, &mnt, SENTINEL, 0);
+ }
+
+ int addmntent(FILE *f, const struct mntent *mnt)
+--
+2.10.0
+
diff --git a/main/musl/APKBUILD b/main/musl/APKBUILD
index 5f4521081a..c794a6eddc 100644
--- a/main/musl/APKBUILD
+++ b/main/musl/APKBUILD
@@ -2,7 +2,7 @@
# Maintainer: Timo Teräs <timo.teras@iki.fi>
pkgname=musl
pkgver=1.1.15
-pkgrel=2
+pkgrel=3
pkgdesc="the musl c library (libc) implementation"
url="http://www.musl-libc.org/"
arch="all"
@@ -14,6 +14,7 @@ subpackages="$pkgname-dev $pkgname-dbg libc6-compat:compat"
[ "$BOOTSTRAP" != "nolibc" ] && subpackages="$subpackages $pkgname-utils"
source="http://www.musl-libc.org/releases/musl-$pkgver.tar.gz
0001-fix-asctime-day-month-names-not-to-vary-by-locale.patch
+ 0001-use-dynamic-buffer-for-getmntent.patch
ldconfig
__stack_chk_fail_local.c
@@ -123,6 +124,7 @@ compat() {
md5sums="9590a9d47ee64f220b3c12f7afb864ca musl-1.1.15.tar.gz
c08825383e41e5dbcd3ffdfd2062dd47 0001-fix-asctime-day-month-names-not-to-vary-by-locale.patch
+c6b8732eea4642112c56f45ff00e356a 0001-use-dynamic-buffer-for-getmntent.patch
830d01f7821b978df770b06db3790921 ldconfig
0df687757221bbb0fc1aa67f1bd646f9 __stack_chk_fail_local.c
57ef2c63b9ec6a2041694ace97d4ffa2 getconf.c
@@ -130,6 +132,7 @@ c08825383e41e5dbcd3ffdfd2062dd47 0001-fix-asctime-day-month-names-not-to-vary-b
45f92f8d59cf84d765de698a9578dbf4 iconv.c"
sha256sums="97e447c7ee2a7f613186ec54a93054fe15469fe34d7d323080f7ef38f5ecb0fa musl-1.1.15.tar.gz
d157100aeed5b0866eb6d50288f63f26ea9900f1d4c7b8a1492294c912b5cc19 0001-fix-asctime-day-month-names-not-to-vary-by-locale.patch
+e1671e2436954f2eec0d2f49dd53e9e66ff0106c9c017a7ff69d35bdb7051055 0001-use-dynamic-buffer-for-getmntent.patch
b4a2c06db38742e8c42c3c9838b285a7d8cdac6c091ff3df5ff9a15f1e41b9c7 ldconfig
299a7d75a09de3e2e11e7fb4acc3182e4a14e868093d2f30938fce9bfcff13da __stack_chk_fail_local.c
d87d0cbb3690ae2c5d8cc218349fd8278b93855dd625deaf7ae50e320aad247c getconf.c
@@ -137,6 +140,7 @@ d87d0cbb3690ae2c5d8cc218349fd8278b93855dd625deaf7ae50e320aad247c getconf.c
f79a2930a2e5bb0624321589edf8b889d1e9b603e01e6b7ae214616605b3fdd7 iconv.c"
sha512sums="9e923572c0d6bad3dc2d2646d4b0699c10b477ce6300ac6c6224895192a90667f581ddf6eda2ab8c4c16f47bde4bccb03bb90478638d136d9df721430f4d0163 musl-1.1.15.tar.gz
1a74d5f5e0f6f2fe6029ed0f18b4603f80c990f19aa13d83c5d1f40f032b2ffb3819aae13ae1f96415bb08571774eec164e71d09028f2a5db4ae9b77e48cafe7 0001-fix-asctime-day-month-names-not-to-vary-by-locale.patch
+a25ff6c640fed110c124f2b12920111befa832202b906649e1d21613dda32b55bada0d59b310f4af2d4ae27c9ce2c92079ba1c919b4898c002f271c7a0c04878 0001-use-dynamic-buffer-for-getmntent.patch
8d3a2d5315fc56fee7da9abb8b89bb38c6046c33d154c10d168fb35bfde6b0cf9f13042a3bceee34daf091bc409d699223735dcf19f382eeee1f6be34154f26f ldconfig
062bb49fa54839010acd4af113e20f7263dde1c8a2ca359b5fb2661ef9ed9d84a0f7c3bc10c25dcfa10bb3c5a4874588dff636ac43d5dbb3d748d75400756d0b __stack_chk_fail_local.c
0d80f37b34a35e3d14b012257c50862dfeb9d2c81139ea2dfa101d981d093b009b9fa450ba27a708ac59377a48626971dfc58e20a3799084a65777a0c32cbc7d getconf.c