summaryrefslogtreecommitdiff
path: root/slstatus.c
diff options
context:
space:
mode:
authorraiz <raiz@firemail.cc>2016-12-18 10:35:36 +0300
committerraiz <raiz@firemail.cc>2016-12-18 10:35:36 +0300
commit5a218e990ca05e6bb087f4fecaaa4807fbe69528 (patch)
tree1a2bb42f1a10d176c3d7d318eacf2c9738acc2e9 /slstatus.c
parent1a143566e60d63435c7504382a717e0503decb47 (diff)
remove unused strlcpy() and reduce the size of output buffer
Diffstat (limited to 'slstatus.c')
-rw-r--r--slstatus.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/slstatus.c b/slstatus.c
index 2b63be4..2d5d173 100644
--- a/slstatus.c
+++ b/slstatus.c
@@ -759,7 +759,7 @@ int
main(int argc, char *argv[])
{
unsigned short int i;
- char status_string[4096];
+ char status_string[2048];
char *res, *element;
struct arg argument;
struct sigaction act;
@@ -811,7 +811,8 @@ main(int argc, char *argv[])
element = smprintf(UNKNOWN_STR);
warnx("Failed to format output");
}
- strlcat(status_string, element, sizeof(status_string));
+ if (strlcat(status_string, element, sizeof(status_string)) >= sizeof(status_string))
+ warnx("Output too long");
free(res);
free(element);
}