From 6b79f29fb230e839c97682f9c8648cac2762669e Mon Sep 17 00:00:00 2001 From: Mikael Magnusson Date: Tue, 6 Jan 2015 01:01:08 +0100 Subject: 34118: Don't crash when writing out history if HOST is unset Found by Coverity (Issue 1255793). --- Src/hist.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'Src') diff --git a/Src/hist.c b/Src/hist.c index a0061707c..8ff9eff82 100644 --- a/Src/hist.c +++ b/Src/hist.c @@ -2801,7 +2801,8 @@ lockhistfile(char *fn, int keep_trying) #ifdef HAVE_LINK # ifdef HAVE_SYMLINK sprintf(pidbuf, "/pid-%ld/host-", (long)mypid); - lnk = bicat(pidbuf, getsparam("HOST")); + lnk = getsparam("HOST"); + lnk = bicat(pidbuf, lnk ? lnk : ""); /* We'll abuse fd as our success flag. */ while ((fd = symlink(lnk, lockfile)) < 0) { if (errno != EEXIST) { -- cgit 1.4.1