]> granicus.if.org Git - git/commit
get_super_prefix(): copy getenv() result
authorJeff King <peff@peff.net>
Fri, 11 Jan 2019 22:15:00 +0000 (17:15 -0500)
committerJunio C Hamano <gitster@pobox.com>
Sat, 12 Jan 2019 02:48:58 +0000 (18:48 -0800)
commit8aac69038fa6c5f957559ca7e08a5e2e8f74d0fa
tree0e6939eaca33b1f4075107f4374e082a1e69d657
parent98cdfbb84ad2ed6a2eb43dafa357a70a4b0a0fad
get_super_prefix(): copy getenv() result

The return value of getenv() is not guaranteed to remain valid across
multiple calls (nor across calls to setenv()). Since this function
caches the result for the length of the program, we must make a copy to
ensure that it is still valid when we need it.

Reported-by: Yngve N. Pettersen <yngve@vivaldi.com>
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
environment.c