python3Packages.orjson: Disable failing tests on 32 bit
[NixPkgs.git] / pkgs / development / libraries / kde-frameworks / kinit / 0004-start_kdeinit-environ-hard-limit.patch
blob2996342deadb634bae739c335f4dae2c8d9dad44
1 From 41e94983dcfbc1667f1b18c5b566aa5c5975edcb Mon Sep 17 00:00:00 2001
2 From: Thomas Tuegel <ttuegel@mailbox.org>
3 Date: Mon, 17 Feb 2020 04:45:03 -0600
4 Subject: [PATCH 4/4] start_kdeinit-environ-hard-limit
6 ---
7 src/start_kdeinit/start_kdeinit.c | 6 +++++-
8 1 file changed, 5 insertions(+), 1 deletion(-)
10 diff --git a/src/start_kdeinit/start_kdeinit.c b/src/start_kdeinit/start_kdeinit.c
11 index f2db3e9..4ff2602 100644
12 --- a/src/start_kdeinit/start_kdeinit.c
13 +++ b/src/start_kdeinit/start_kdeinit.c
14 @@ -148,7 +148,11 @@ int main(int argc, char **argv)
15 ++i) {
16 unsigned len;
17 if (read(0, &len, sizeof(unsigned)) == sizeof(unsigned)
18 - && len && len < (1 << 12)) {
19 + && len) {
20 + if (len >= (1 << 20)) {
21 + fprintf(stderr, "%s: exceeded environment length limit", argv[0]);
22 + return 1;
23 + }
24 env[ i ] = malloc(len + 1);
25 if ((unsigned) read(0, env[ i ], len) == len) {
26 env[ i ][ len ] = '\0';
27 --
28 2.23.1