summaryrefslogtreecommitdiff
path: root/system/skalibs/env_dump-unterminated-strings.patch
diff options
context:
space:
mode:
authorLuis Ressel <aranea@aixah.de>2019-08-10 23:47:29 +0200
committerLuis Ressel <aranea@aixah.de>2019-08-10 23:50:10 +0200
commitf007bb1149fd55b5dc75ffb8db2c32173c3f50e6 (patch)
tree76347ef25bf553292e2c20ccb962dd236089c0c9 /system/skalibs/env_dump-unterminated-strings.patch
parent46f9ac5ef34bf589dd512d69283f34bd0c2a5bc9 (diff)
downloadpackages-f007bb1149fd55b5dc75ffb8db2c32173c3f50e6.tar.gz
packages-f007bb1149fd55b5dc75ffb8db2c32173c3f50e6.tar.bz2
packages-f007bb1149fd55b5dc75ffb8db2c32173c3f50e6.tar.xz
packages-f007bb1149fd55b5dc75ffb8db2c32173c3f50e6.zip
system/skalibs: Add patch for env_dump()
This has already been applied upstream and fixes s6-linux-init's /run/kernel_env/ output.
Diffstat (limited to 'system/skalibs/env_dump-unterminated-strings.patch')
-rw-r--r--system/skalibs/env_dump-unterminated-strings.patch26
1 files changed, 26 insertions, 0 deletions
diff --git a/system/skalibs/env_dump-unterminated-strings.patch b/system/skalibs/env_dump-unterminated-strings.patch
new file mode 100644
index 000000000..a20a78125
--- /dev/null
+++ b/system/skalibs/env_dump-unterminated-strings.patch
@@ -0,0 +1,26 @@
+From d69644de85148f56efeed4259a783881e2a1bddc Mon Sep 17 00:00:00 2001
+From: Laurent Bercot <ska-skaware@skarnet.org>
+Date: Wed, 31 Jul 2019 23:47:35 +0000
+Subject: [PATCH] bugfix: env_dump() unterminated strings
+
+---
+ src/libstddjb/env_dump.c | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+diff --git a/src/libstddjb/env_dump.c b/src/libstddjb/env_dump.c
+index fc79bc3..10f5913 100644
+--- a/src/libstddjb/env_dump.c
++++ b/src/libstddjb/env_dump.c
+@@ -32,7 +32,8 @@ int env_dump (char const *dir, mode_t mode, char const *const *envp)
+ size_t len = str_chr(*envp, '=') ;
+ size_t vallen = strlen(*envp + len + 1) ;
+ char fn[len + 1] ;
+- memcpy(fn, *envp, len + 1) ;
++ memcpy(fn, *envp, len) ;
++ fn[len] = 0 ;
+ len = openwritenclose_at(fd, fn, *envp + len + 1, vallen) ;
+ if (len < vallen) goto cerr ;
+ }
+--
+2.22.0
+