all repos — slstatus @ c7f3a407f4f8d539fe68cbf7dde76876cbcbccaa

my build of slstatus (tools.suckless.org/slstatus/)

fixed hostname function and added HOST_NAME_MAX limit
Aaron Marcher info@nulltime.net
Fri, 10 Jun 2016 18:22:05 +0200
commit

c7f3a407f4f8d539fe68cbf7dde76876cbcbccaa

parent

2e72b212d3019a23accfd9d001bcec5d3ee5ab46

1 files changed, 3 insertions(+), 2 deletions(-)

jump to
M slstatus.cslstatus.c

@@ -5,6 +5,7 @@ #include <alsa/asoundlib.h>

#include <arpa/inet.h> #include <fcntl.h> #include <ifaddrs.h> +#include <limits.h> #include <locale.h> #include <netdb.h> #include <stdarg.h>

@@ -212,7 +213,7 @@ /* hostname */

char * hostname(const char *null) { - char *hostname = ""; + char hostname[HOST_NAME_MAX]; FILE *fp; /* open hostname file */

@@ -222,7 +223,7 @@ return smprintf("n/a");

} /* extract hostname */ - fscanf(fp, "%s", hostname); + fscanf(fp, "%s\n", hostname); /* close hostname file */ fclose(fp);