From: Lennart Poettering Date: Tue, 27 Feb 2018 16:45:30 +0000 (+0100) Subject: resolve-tool: use reallocarray() where appropriate X-Git-Tag: v238~14^2~2 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=3209c8e6502c095bb7a88a3e915f06dd56228ed4;p=thirdparty%2Fsystemd.git resolve-tool: use reallocarray() where appropriate --- diff --git a/src/resolve/resolve-tool.c b/src/resolve/resolve-tool.c index 2a6bf94070f..5462c293823 100644 --- a/src/resolve/resolve-tool.c +++ b/src/resolve/resolve-tool.c @@ -2116,7 +2116,7 @@ static int parse_argv(int argc, char *argv[]) { if (r < 0) return log_error_errno(r, "Failed to parse DNS server address: %s", optarg); - n = realloc(arg_set_dns, sizeof(struct in_addr_data) * (arg_n_set_dns + 1)); + n = reallocarray(arg_set_dns, arg_n_set_dns + 1, sizeof(struct in_addr_data)); if (!n) return log_oom(); arg_set_dns = n;