You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

35 lines
1.3 KiB

diff -up netkit-rsh-0.17/rexecd/rexecd.c netkit-rsh-0.17/rexecd/rexecd.c
--- netkit-rsh-0.17/rexecd/rexecd.c 2017-10-17 10:50:49.508905643 +0200
+++ netkit-rsh-0.17/rexecd/rexecd.c 2017-10-17 11:47:32.563051760 +0200
@@ -261,7 +261,14 @@ doit(struct sockaddr_in *fromp)
fatal ("sysconf (_SC_ARG_MAX) failed\n");
}
- cmdbuf = malloc (++cmdbuflen);
+ cmdbuflen++;
+ /* Decrease cmdbuflen to reasonable number if it's too high */
+ if ((size_t) cmdbuflen > 131072) {
+ cmdbuflen = 131072;
+ syslog (LOG_INFO, "Decreasing cmdbuflen because it was too high (>131072 bytes)");
+ }
+
+ cmdbuf = malloc (cmdbuflen);
if (cmdbuf == NULL) {
syslog (LOG_ERR, "Could not allocate space for cmdbuf");
fatal ("Could not allocate space for cmdbuf\n");
diff -up netkit-rsh-0.17/rshd/rshd.c netkit-rsh-0.17/rshd/rshd.c
--- netkit-rsh-0.17/rshd/rshd.c 2017-10-17 11:26:15.192221595 +0200
+++ netkit-rsh-0.17/rshd/rshd.c 2017-10-17 11:47:26.065986220 +0200
@@ -433,8 +433,10 @@ doit(struct sockaddr_storage *fromp, soc
cmdbuflen++;
/* Decrease cmdbuflen to reasonable number if it's too high */
- if ((size_t) cmdbuflen > 131072)
+ if ((size_t) cmdbuflen > 131072) {
cmdbuflen = 131072;
+ syslog (LOG_INFO, "Decreasing cmdbuflen because it was too high (>131072 bytes)");
+ }
cmdbuf = malloc (cmdbuflen);
if (cmdbuf == NULL) {