From: Guus Sliepen Date: Sat, 10 Nov 2012 22:13:05 +0000 (+0100) Subject: Using alloca() for a constant sized buffer is very silly. X-Git-Tag: import-tinc-1.1~244 X-Git-Url: https://git.meshlink.io/?a=commitdiff_plain;h=ade4fccad6857f3d6d548e52bc94ab23751e4fef;p=meshlink Using alloca() for a constant sized buffer is very silly. Cppcheck said using alloca() in the 21st century is silly anyway. --- diff --git a/src/net_setup.c b/src/net_setup.c index d53aad00..7485d21f 100644 --- a/src/net_setup.c +++ b/src/net_setup.c @@ -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;