]> 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 03:07:38 +0000 (03:07 +0000)
committerPedro F. Giffuni <pfg@FreeBSD.org>
Sat, 19 Dec 2020 03:07:38 +0000 (03:07 +0000)
commitdcc6f62526ad357f17fe030f6b9b4c3001add705
tree4a0c23f96cc3eb549a295c665d1e851d1bc0f4b1
parenta0bed901984022e6e0fdfc017c70e31302de878e
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.

(This change redoes r368776 due to a silly mistake)
usr.bin/login/login.c