]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
login(1): when exporting variables check the result of setenv(3)
authorPedro F. Giffuni <pfg@FreeBSD.org>
Sat, 19 Dec 2020 02:23:53 +0000 (02:23 +0000)
committerPedro F. Giffuni <pfg@FreeBSD.org>
Sat, 19 Dec 2020 02:23:53 +0000 (02:23 +0000)
commitebb4fcc7cf3045dcd3b7ff6eb6877fb4ec4a9e05
tree923072d0fa39a423e0f63b8079ccc8092dfe9d02
parent15575436693e953816a18acd4d9c0bf35d8ca39c
login(1): when exporting variables check the result of setenv(3)

When exporting a variable we correctly check all the preconditions that
could make setenv(3) fail. Checking the setenv(3) return value seems
redundant, but given that login(1) is critical, it doesn't hurt to have
a post-check.

This change is based on the "Principles of Secure Coding" course by
Matthew Bishop, PhD., which specifically discusses this code in FreeBSD.

Differential Revision: https://reviews.freebsd.org/D26966
usr.bin/login/login.c