From: Simon Tatham Date: Tue, 14 Feb 2017 20:47:16 +0000 (+0000) Subject: Put in some explicit null-pointer checks. X-Git-Tag: 0.68~25 X-Git-Url: https://asedeno.scripts.mit.edu/gitweb/?a=commitdiff_plain;h=2247065d0fa88daf8499eb937ee60e8e3df22261;p=PuTTY.git 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). --- diff --git a/unix/uxstore.c b/unix/uxstore.c index a080e294..15801785 100644 --- a/unix/uxstore.c +++ b/unix/uxstore.c @@ -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; }