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.
 
 
 
 
 
 

82 lines
2.6 KiB

diff -up netkit-rsh-0.17/rexecd/rexecd.c.arg_max netkit-rsh-0.17/rexecd/rexecd.c
--- netkit-rsh-0.17/rexecd/rexecd.c.arg_max 2008-05-09 10:36:44.000000000 +0200
+++ netkit-rsh-0.17/rexecd/rexecd.c 2008-05-09 10:36:44.000000000 +0200
@@ -235,7 +235,8 @@ static struct pam_conv PAM_conversation
static void
doit(struct sockaddr_in *fromp)
{
- char cmdbuf[ARG_MAX+1];
+ char *cmdbuf;
+ long cmdbuflen;
char user[17], pass[17];
struct passwd *pwd;
int s = -1;
@@ -254,6 +255,18 @@ doit(struct sockaddr_in *fromp)
#endif
#endif /* USE_PAM */
+ cmdbuflen = sysconf (_SC_ARG_MAX);
+ if (!(cmdbuflen > 0)) {
+ syslog (LOG_ERR, "sysconf (_SC_ARG_MAX) failed");
+ fatal ("sysconf (_SC_ARG_MAX) failed\n");
+ }
+
+ cmdbuf = malloc (++cmdbuflen);
+ if (cmdbuf == NULL) {
+ syslog (LOG_ERR, "Could not allocate space for cmdbuf");
+ fatal ("Could not allocate space for cmdbuf\n");
+ }
+
signal(SIGINT, SIG_DFL);
signal(SIGQUIT, SIG_DFL);
signal(SIGTERM, SIG_DFL);
@@ -303,7 +316,7 @@ doit(struct sockaddr_in *fromp)
getstr(user, sizeof(user), "username too long\n");
getstr(pass, sizeof(pass), "password too long\n");
- getstr(cmdbuf, sizeof(cmdbuf), "command too long\n");
+ getstr(cmdbuf, cmdbuflen, "command too long\n");
#ifdef USE_PAM
#define PAM_BAIL if (pam_error != PAM_SUCCESS) { \
pam_end(pamh, pam_error); exit(1); \
diff -up netkit-rsh-0.17/rshd/rshd.c.arg_max netkit-rsh-0.17/rshd/rshd.c
--- netkit-rsh-0.17/rshd/rshd.c.arg_max 2008-05-09 10:36:44.000000000 +0200
+++ netkit-rsh-0.17/rshd/rshd.c 2008-05-09 10:38:51.000000000 +0200
@@ -402,7 +402,8 @@ static int log_audit(const char *usernam
static void
doit(struct sockaddr_storage *fromp, socklen_t fromlen)
{
- char cmdbuf[ARG_MAX+1];
+ char *cmdbuf;
+ long cmdbuflen;
const char *theshell, *shellname;
char locuser[16], remuser[16];
struct passwd *pwd;
@@ -415,6 +416,18 @@ doit(struct sockaddr_storage *fromp, soc
int i;
#endif
+ cmdbuflen = sysconf (_SC_ARG_MAX);
+ if (!(cmdbuflen > 0)) {
+ syslog (LOG_ERR, "sysconf (_SC_ARG_MAX) failed");
+ exit (1);
+ }
+
+ cmdbuf = malloc (++cmdbuflen);
+ if (cmdbuf == NULL) {
+ syslog (LOG_ERR, "Could not allocate space for cmdbuf");
+ exit (1);
+ }
+
signal(SIGINT, SIG_DFL);
signal(SIGQUIT, SIG_DFL);
signal(SIGTERM, SIG_DFL);
@@ -460,7 +473,7 @@ doit(struct sockaddr_storage *fromp, soc
getstr(remuser, sizeof(remuser), "remuser");
getstr(locuser, sizeof(locuser), "locuser");
- getstr(cmdbuf, sizeof(cmdbuf), "command");
+ getstr(cmdbuf, cmdbuflen, "command");
if (!strcmp(locuser, "root")) paranoid = 1;
hostname = findhostname((struct sockaddr *)fromp, fromlen,