aboutsummaryrefslogtreecommitdiff
path: root/net/addrwatch/patches/003-add-space-for-null-byte.patch
blob: a55270743b2e6efe8ec85b19c9daf87bad5981fa (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
From 374cfd2cabe4db9882d8a210adff430cc579f859 Mon Sep 17 00:00:00 2001
From: Julius Kriukas <julius@kriukas.lt>
Date: Sun, 8 Mar 2020 12:46:55 +0200
Subject: [PATCH] Use HOST_NAME_MAX+1 to add space for null byte

---
 src/addrwatch.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/src/addrwatch.c
+++ b/src/addrwatch.c
@@ -501,7 +501,7 @@ int main(int argc, char *argv[])
 	argp_parse(&argp, argc, argv, 0, &optind, 0);
 
 	if (!cfg.hostname) {
-		cfg.hostname_len = HOST_NAME_MAX;
+		cfg.hostname_len = HOST_NAME_MAX + 1;
 		cfg.hostname = (char *)calloc(cfg.hostname_len, sizeof(char));
 		gethostname(cfg.hostname, cfg.hostname_len);
 	}