diff --git a/NEWS b/NEWS index bb3f5f1d..9f546c3b 100644 --- a/NEWS +++ b/NEWS @@ -13,6 +13,10 @@ https://lists.gnu.org/archive/html/bug-inetutils/2024-03/msg00000.html ** ifconfig: With -A, reject invalid prefix length specifications, and correctly handle a prefix length of 0. +** ifconfig: Fix a 'dynamic-stack-buffer-overflow' detected by AddressSanitizer +when using the --format or --short option. More details in +. + * Noteworthy changes in release 2.5 (2023-12-29) [stable] ** ftpd, rcp, rlogin, rsh, rshd, uucpd diff --git a/ifconfig/printif.c b/ifconfig/printif.c index f68547bd..44237329 100644 --- a/ifconfig/printif.c +++ b/ifconfig/printif.c @@ -1133,7 +1133,7 @@ print_interfaceX (format_data_t form, int quiet) form->format = p; print_interfaceX (form, 1); q = form->format; - argv = xrealloc (argv, (argc + 1) * sizeof (char *)); + argv = xrealloc (argv, (argc + 1) * sizeof (char *)); argv[argc] = xmalloc (q - p + 1); memcpy (argv[argc], p, q - p); argv[argc][q - p] = '\0'; @@ -1144,14 +1144,14 @@ print_interfaceX (format_data_t form, int quiet) } format_handler (id, form, argc, argv); - if (argv != NULL) - { - /* Clean up. */ - while (--argc >= 0) - free (argv[argc]); - free (argv); - } - form->format = p; + if (argv != NULL) + { + /* Clean up. */ + while (--argc >= 0) + free (argv[argc]); + free (argv); + } + form->format = p; } } }