]> git.ipfire.org Git - network.git/commitdiff
inetcalc: Fix compiler warnings
authorMichael Tremer <michael.tremer@ipfire.org>
Sat, 22 Jun 2019 13:31:03 +0000 (13:31 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Sat, 22 Jun 2019 13:31:03 +0000 (13:31 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/inetcalc.c

index 1841c84065975b7e9beff194f8a67bc81118d12a..7c072e99214b7172a1ebb422c0f52b8c8379d8be 100644 (file)
@@ -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, '/');