From 2247065d0fa88daf8499eb937ee60e8e3df22261 Mon Sep 17 00:00:00 2001 From: Simon Tatham Date: Tue, 14 Feb 2017 20:47:16 +0000 Subject: [PATCH] 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). --- unix/uxstore.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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; } -- 2.45.1