From 8a3c8443579971eff1d42db864952ca8a910780c Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Fri, 27 Aug 1999 21:44:13 +0000 Subject: [PATCH] Update. * inet/rexec.c (rexec): Free memory if strings were allocated in ruserpass. Reported by Andrew Morton . 1999-08-27 Ulrich Drepper --- ChangeLog | 5 +++++ inet/rexec.c | 10 ++++++++++ 2 files changed, 15 insertions(+) diff --git a/ChangeLog b/ChangeLog index 2e98a5d..855207c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,10 @@ 1999-08-27 Ulrich Drepper + * inet/rexec.c (rexec): Free memory if strings were allocated in + ruserpass. Reported by Andrew Morton . + +1999-08-27 Ulrich Drepper + * locale/categories.def: Use __YESSTR amd __NOSTR in definition. * manual/argp.texi: Fixing language and typos. diff --git a/inet/rexec.c b/inet/rexec.c index 897030e..643f277 100644 --- a/inet/rexec.c +++ b/inet/rexec.c @@ -54,6 +54,8 @@ rexec(ahost, rport, name, pass, cmd, fd2p) { struct sockaddr_in sin, sin2, from; struct hostent hostbuf, *hp; + const char *orig_name = name; + const char *orig_pass = pass; size_t hstbuflen; char *hsttmpbuf; u_short port; @@ -138,6 +140,14 @@ retry: /* should public key encypt the password here */ (void) __write(s, pass, strlen(pass) + 1); (void) __write(s, cmd, strlen(cmd) + 1); + + /* We don't need the memory allocated for the name and the password + in ruserpass anymore. */ + if (name != orig_name) + free (name); + if (pass != orig_pass) + free (pass); + if (__read(s, &c, 1) != 1) { perror(*ahost); goto bad; -- 2.7.4