]> git.ipfire.org Git - thirdparty/openssh-portable.git/commitdiff
don't free string returned by login_getcapstr(3)
authorDamien Miller <djm@mindrot.org>
Wed, 17 Feb 2021 23:33:58 +0000 (10:33 +1100)
committerDamien Miller <djm@mindrot.org>
Wed, 17 Feb 2021 23:36:54 +0000 (10:36 +1100)
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

index e63fc472c2457d49aabba2f1ee7ed2ca0e870433..4b155f913f2c0e4ece8ae0ee99a21a7c0faef75b 100644 (file)
--- 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);