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

  1. From 374cfd2cabe4db9882d8a210adff430cc579f859 Mon Sep 17 00:00:00 2001
  2. From: Julius Kriukas <julius@kriukas.lt>
  3. Date: Sun, 8 Mar 2020 12:46:55 +0200
  4. Subject: [PATCH] Use HOST_NAME_MAX+1 to add space for null byte
  5. ---
  6. src/addrwatch.c | 2 +-
  7. 1 file changed, 1 insertion(+), 1 deletion(-)
  8. --- a/src/addrwatch.c
  9. +++ b/src/addrwatch.c
  10. @@ -501,7 +501,7 @@ int main(int argc, char *argv[])
  11. argp_parse(&argp, argc, argv, 0, &optind, 0);
  12. if (!cfg.hostname) {
  13. - cfg.hostname_len = HOST_NAME_MAX;
  14. + cfg.hostname_len = HOST_NAME_MAX + 1;
  15. cfg.hostname = (char *)calloc(cfg.hostname_len, sizeof(char));
  16. gethostname(cfg.hostname, cfg.hostname_len);
  17. }