From: David Levine Date: Sun, 15 Mar 2020 21:35:55 +0000 (-0400) Subject: Added check for passing null argument to printf(3) %s directive. X-Git-Url: https://diplodocus.org/git/nmh/commitdiff_plain/61e8f5df2a0daf966a27004e7eb0f11a1e700c4c Added check for passing null argument to printf(3) %s directive. This fixed "directive argument is null" warnings found by gcc -Wformat-overflow. --- 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");