From 846588ee81c781c9c28cce530aa9b6b150e27f37 Mon Sep 17 00:00:00 2001 From: Benno Schulenberg Date: Wed, 30 Nov 2022 12:00:07 +0100 Subject: [PATCH] tweaks: avoid passing NULL to access() This prevents an unwanted message when nano is compiled with -fsanitize=undefined. This fixes https://savannah.gnu.org/bugs/?63447. Problem existed since version 4.8, commit 343f97b3, since the --rcfile option was added. --- src/rcfile.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/rcfile.c b/src/rcfile.c index 966da5d8..f36e05a2 100644 --- a/src/rcfile.c +++ b/src/rcfile.c @@ -1707,7 +1707,7 @@ void do_rcfiles(void) { if (custom_nanorc) { nanorc = get_full_path(custom_nanorc); - if (access(nanorc, F_OK) != 0) + if (nanorc == NULL || access(nanorc, F_OK) != 0) die(_("Specified rcfile does not exist\n")); } else nanorc = mallocstrcpy(nanorc, SYSCONFDIR "/nanorc");