summaryrefslogtreecommitdiff
path: root/system/skalibs/env_dump-unterminated-strings.patch
diff options
context:
space:
mode:
authorA. Wilcox <awilcox@wilcox-tech.com>2019-08-13 13:47:43 +0000
committerA. Wilcox <awilcox@wilcox-tech.com>2019-08-13 13:47:43 +0000
commit255c2244a924e045132a8c4d10ce9b2f18bd3126 (patch)
treed20969cf05eeb8de1496c4877a5d4fcf294ddb7a /system/skalibs/env_dump-unterminated-strings.patch
parentdef1af5fb9ae240ab8c2681e21dfbde0b36901aa (diff)
parent069170e3f1c600c93cf3a788f575676998f3fdd5 (diff)
downloadpackages-255c2244a924e045132a8c4d10ce9b2f18bd3126.tar.gz
packages-255c2244a924e045132a8c4d10ce9b2f18bd3126.tar.bz2
packages-255c2244a924e045132a8c4d10ce9b2f18bd3126.tar.xz
packages-255c2244a924e045132a8c4d10ce9b2f18bd3126.zip
Merge branch 'lr/env_dump' into 'master'
Fix skalibs env_dump() See merge request adelie/packages!317
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
+