]> git.ipfire.org Git - thirdparty/git.git/commit - path.c
expand_user_path: do not look at NULL path
authorJeff King <peff@peff.net>
Tue, 28 Jan 2014 01:36:12 +0000 (20:36 -0500)
committerJunio C Hamano <gitster@pobox.com>
Tue, 28 Jan 2014 19:59:47 +0000 (11:59 -0800)
commit53ec551c87c731c5c4171e943842998bdfb5548e
tree8a7d9b6385a7987b28392f33f2299b2399e03c65
parent4c0a89fcde219df8db8fdb9635ef2ef40d002a6e
expand_user_path: do not look at NULL path

We explicitly check for and handle the case that the
incoming "path" variable is NULL, but before doing so we
call strchrnul on it, leading to a potential segfault.

We can fix this simply by moving the strchrnul call down; as
a bonus, we can tighten the scope on the associated
variable.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
path.c