From 61e8f5df2a0daf966a27004e7eb0f11a1e700c4c Mon Sep 17 00:00:00 2001 From: David Levine Date: Sun, 15 Mar 2020 17:35:55 -0400 Subject: [PATCH] Added check for passing null argument to printf(3) %s directive. This fixed "directive argument is null" warnings found by gcc -Wformat-overflow. --- sbr/ruserpass.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sbr/ruserpass.c b/sbr/ruserpass.c index 77b57a7e..4b3d81ba 100644 --- a/sbr/ruserpass.c +++ b/sbr/ruserpass.c @@ -153,7 +153,7 @@ ruserpass(const char *host, char **aname, char **apass, int flags) if ((pp = getpwuid (getuid())) != NULL) myname = pp->pw_name; } - printf("Name (%s:%s): ", host, myname); + printf("Name (%s:%s): ", host ? host : "", myname); if (fgets(tmp, sizeof tmp, stdin) == NULL) { advise ("tmp", "fgets"); -- 2.56.0