nixpkgs/pkgs/development/libraries/kde-frameworks/kinit/0004-start_kdeinit-environ-hard-limit.patch
Yaroslav Bolyukin 0fbd3e9591
kinit: increase environment limit
Limit is already increased for standard xorg plasma distribution to
start, but with wayland, even more libraries being added

Increasing this limit to 1 << 20 (1M) seems to be enough (For me
length is 80K), and not so much for regular desktops

Signed-off-by: Yaroslav Bolyukin <iam@lach.pw>
2020-12-23 17:46:59 +03:00

29 lines
1.2 KiB
Diff

From 41e94983dcfbc1667f1b18c5b566aa5c5975edcb Mon Sep 17 00:00:00 2001
From: Thomas Tuegel <ttuegel@mailbox.org>
Date: Mon, 17 Feb 2020 04:45:03 -0600
Subject: [PATCH 4/4] start_kdeinit-environ-hard-limit
---
src/start_kdeinit/start_kdeinit.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/src/start_kdeinit/start_kdeinit.c b/src/start_kdeinit/start_kdeinit.c
index f2db3e9..4ff2602 100644
--- a/src/start_kdeinit/start_kdeinit.c
+++ b/src/start_kdeinit/start_kdeinit.c
@@ -148,7 +148,11 @@ int main(int argc, char **argv)
++i) {
unsigned len;
if (read(0, &len, sizeof(unsigned)) == sizeof(unsigned)
- && len && len < (1 << 12)) {
+ && len) {
+ if (len >= (1 << 20)) {
+ fprintf(stderr, "%s: exceeded environment length limit", argv[0]);
+ return 1;
+ }
env[ i ] = malloc(len + 1);
if ((unsigned) read(0, env[ i ], len) == len) {
env[ i ][ len ] = '\0';
--
2.23.1