summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAaron Marcher <info@nulltime.net>2017-01-07 21:19:40 +0100
committerAaron Marcher <info@nulltime.net>2017-01-07 21:19:40 +0100
commit61680e26a34513f24e0187d6c0bd48a63f633f04 (patch)
tree5240d83e8d1a1daf64cf56e18d61620ce08261b5
parent8f6964d6d0106a2145b4bc8338736e703b27bb63 (diff)
run_command: strlen() will not function if string is not null terminated
-rw-r--r--slstatus.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/slstatus.c b/slstatus.c
index 3ad79c0..4432e18 100644
--- a/slstatus.c
+++ b/slstatus.c
@@ -426,7 +426,7 @@ run_command(const char *cmd)
}
fgets(buf, sizeof(buf), fp);
pclose(fp);
- buf[strlen(buf)] = '\0';
+ buf[sizeof(buf)] = '\0';
if ((nlptr = strstr(buf, "\n")) != NULL) {
nlptr[0] = '\0';