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: release-1.0.20~15 X-Git-Url: https://www.tinc-vpn.org/git/browse?p=tinc;a=commitdiff_plain;h=13739025e0b2d80e462a3bf78bb5823a4db3a47e;hp=2260ed0523d3c11cfb5d6c86b83c765a7f9ecbf0 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 3e435dda..ddb0bcfd 100644 --- a/src/net_setup.c +++ b/src/net_setup.c @@ -299,7 +299,7 @@ char *get_name(void) { fprintf(stderr, "Invalid Name: environment variable %s does not exist\n", name + 1); return false; } - envname = alloca(32); + char envname[32]; if(gethostname(envname, 32)) { fprintf(stderr, "Could not get hostname: %s\n", strerror(errno)); return false;