1
1

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.
Этот коммит содержится в:
Benno Schulenberg 2022-11-30 12:00:07 +01:00
родитель 4f92b12a6a
Коммит 846588ee81

Просмотреть файл

@ -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");