]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
login(1): when exporting variables check the result of setenv(3)
authorpfg <pfg@FreeBSD.org>
Sat, 19 Dec 2020 02:23:53 +0000 (02:23 +0000)
committerpfg <pfg@FreeBSD.org>
Sat, 19 Dec 2020 02:23:53 +0000 (02:23 +0000)
commit60c9d20436a8613ab048391994d0d4a1c99848b5
tree923072d0fa39a423e0f63b8079ccc8092dfe9d02
parent03496eb9d897ab9063f132bbab1759b774b2f73a
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