1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-01-25 01:02:24 +00:00

Put in some explicit null-pointer checks.

I think these were not strictly necessary, since passing a null
pointer to access(2) would have resulted in EINVAL rather than a
segfault. But it's clearer to put them in (and keeps static checkers a
bit happier).
This commit is contained in:
Simon Tatham 2017-02-14 20:47:16 +00:00
parent bda87b39e4
commit 2247065d0f

View File

@ -140,11 +140,11 @@ static char *make_filename(int index, const char *subname)
}
old_dir3 = dupstr("/.putty");
if (access(old_dir, F_OK) == 0) {
if (old_dir && access(old_dir, F_OK) == 0) {
ret = old_dir;
goto out;
}
if (access(old_dir2, F_OK) == 0) {
if (old_dir2 && access(old_dir2, F_OK) == 0) {
ret = old_dir2;
goto out;
}