projects
/
suckless
/
slstatus.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
2e72b21
)
fixed hostname function and added HOST_NAME_MAX limit
author
Aaron Marcher
<info@nulltime.net>
Fri, 10 Jun 2016 16:22:05 +0000
(18:22 +0200)
committer
Aaron Marcher (drkhsh)
<info@nulltime.net>
Fri, 10 Jun 2016 16:22:05 +0000
(18:22 +0200)
slstatus.c
patch
|
blob
|
history
diff --git
a/slstatus.c
b/slstatus.c
index 5bbf58a551beaa06cf77f863abe3985b30648992..404ead6a03b77364e3805901c36516fa6ec29f5b 100644
(file)
--- a/
slstatus.c
+++ b/
slstatus.c
@@
-5,6
+5,7
@@
#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
@@
entropy(const char *null)
char *
hostname(const char *null)
{
- char
*hostname = ""
;
+ char
hostname[HOST_NAME_MAX]
;
FILE *fp;
/* open hostname file */
@@
-222,7
+223,7
@@
hostname(const char *null)
}
/* extract hostname */
- fscanf(fp, "%s", hostname);
+ fscanf(fp, "%s
\n
", hostname);
/* close hostname file */
fclose(fp);