commit 846588ee81c781c9c28cce530aa9b6b150e27f37
parent 4f92b12a6a5ff2c3da38a7d8d99b665f51a4f7df
Author: Benno Schulenberg <bensberg@telfort.nl>
Date: Wed, 30 Nov 2022 12:00:07 +0100
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.
Diffstat:
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git 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");