[openssh-commits] [openssh] 01/01: don't free string returned by login_getcapstr(3)

git+noreply at mindrot.org git+noreply at mindrot.org
Thu Feb 18 10:36:59 AEDT 2021


This is an automated email from the git hooks/post-receive script.

djm pushed a commit to branch master
in repository openssh.

commit f060c2bc85d59d111fa18a12eb3872ee4b9f7e97
Author: Damien Miller <djm at mindrot.org>
Date:   Thu Feb 18 10:33:58 2021 +1100

    don't free string returned by login_getcapstr(3)
    
    OpenBSD and NetBSD require the caller to free strings returned
    bu the login_* functions, but FreeBSD requires that callers don't.
    
    Fortunately in this case, we can harmlessly leak as the process is
    about to exec the shell/command.
    
    From https://reviews.freebsd.org/D28617 via Ed Maste; ok dtucker@
---
 session.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/session.c b/session.c
index e63fc472..4b155f91 100644
--- a/session.c
+++ b/session.c
@@ -1287,11 +1287,8 @@ do_nologin(struct passwd *pw)
 		return;
 	nl = def_nl;
 #endif
-	if (stat(nl, &sb) == -1) {
-		if (nl != def_nl)
-			free(nl);
+	if (stat(nl, &sb) == -1)
 		return;
-	}
 
 	/* /etc/nologin exists.  Print its contents if we can and exit. */
 	logit("User %.100s not allowed because %s exists", pw->pw_name, nl);

-- 
To stop receiving notification emails like this one, please contact
djm at mindrot.org.


More information about the openssh-commits mailing list