From: Michael Tremer Date: Sat, 22 Jun 2019 13:31:03 +0000 (+0000) Subject: inetcalc: Fix compiler warnings X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d07532fad069c51d188ba7b93539488499d5dbf9;p=network.git inetcalc: Fix compiler warnings Signed-off-by: Michael Tremer --- diff --git a/src/inetcalc.c b/src/inetcalc.c index 1841c840..7c072e99 100644 --- a/src/inetcalc.c +++ b/src/inetcalc.c @@ -134,9 +134,9 @@ static int default_prefix(const int family) { static int ip_address_parse_simple(ip_address_t* ip, const int family, const char* address) { assert(family == AF_INET || family == AF_INET6); - size_t address_length = strlen(address); - char buffer[address_length + 1]; - strncpy(buffer, address, sizeof(buffer)); + // Copy input to stack + char buffer[512]; + strncpy(buffer, address, sizeof(buffer) - 1); // Search for a prefix or subnet mask char* prefix = strchr(buffer, '/');