diff options
author | Damien Miller <djm@mindrot.org> | 2021-02-18 10:33:58 +1100 |
---|---|---|
committer | Damien Miller <djm@mindrot.org> | 2021-02-18 10:36:54 +1100 |
commit | f060c2bc85d59d111fa18a12eb3872ee4b9f7e97 (patch) | |
tree | 19d19e9158b517b300a4c02bde69e6cc1a8cccaa | |
parent | bc9b0c25703215501da28aa7a6539f96c0fa656f (diff) |
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@
-rw-r--r-- | session.c | 5 |
1 files changed, 1 insertions, 4 deletions
@@ -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); |