From 1ad9f2504d3b547ceb3e6e92215bc2d42164e782 Mon Sep 17 00:00:00 2001 From: Aaron Marcher Date: Wed, 14 Sep 2016 11:04:24 +0200 Subject: hostname() null terminaiton subtraction *is* needed --- slstatus.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/slstatus.c b/slstatus.c index ea8fc20..572f964 100644 --- a/slstatus.c +++ b/slstatus.c @@ -273,7 +273,7 @@ hostname(void) fgets(hostname, sizeof(hostname), fp); /* FIXME: needs improvement */ - memset(&hostname[strlen(hostname)], '\0', + memset(&hostname[strlen(hostname)-1], '\0', sizeof(hostname) - strlen(hostname)); fclose(fp); -- cgit v1.2.3