authpf: do not sprintf to a null pointer

The fgetln loop will terminate with buf = NULL at EOF.

Reported by:	GCC
Reviewed by:	kp
MFC after:	3 days
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D39947
This commit is contained in:
Ed Maste 2023-05-03 09:26:42 -04:00
parent d411c1d696
commit 81f964e2ff

View File

@ -566,9 +566,8 @@ allowed_luser(struct passwd *pw)
syslog(LOG_INFO, "denied access to %s: not listed in %s",
pw->pw_name, PATH_ALLOWFILE);
/* reuse buf */
sprintf(buf, "%s", "\n\nSorry, you are not allowed to use this facility!\n");
fputs(buf, stdout);
fputs("\n\nSorry, you are not allowed to use this facility!\n",
stdout);
}
fflush(stdout);
return (0);