You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

20 lines
656 B

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);
}