]> git.meshlink.io Git - meshlink/commitdiff
Using alloca() for a constant sized buffer is very silly.
authorGuus Sliepen <guus@tinc-vpn.org>
Sat, 10 Nov 2012 22:13:05 +0000 (23:13 +0100)
committerGuus Sliepen <guus@tinc-vpn.org>
Sat, 10 Nov 2012 22:13:05 +0000 (23:13 +0100)
Cppcheck said using alloca() in the 21st century is silly anyway.

src/net_setup.c

index d53aad004f28dc2d461b02714c0f1c89ad9abdd2..7485d21f60507ac6de8dbe1f592038b4beb320a2 100644 (file)
@@ -393,7 +393,7 @@ char *get_name(void) {
                                logger(DEBUG_ALWAYS, LOG_ERR, "Invalid Name: environment variable %s does not exist\n", name + 1);
                                return false;
                        }
-                       envname = alloca(32);
+                       char envname[32];
                        if(gethostname(envname, 32)) {
                                logger(DEBUG_ALWAYS, LOG_ERR, "Could not get hostname: %s\n", strerror(errno));
                                return false;