X-Git-Url: https://tinc-vpn.org/git/browse?a=blobdiff_plain;f=src%2Fscript.c;h=cb3d29345e9bb49b18c1de4a045710e396036076;hb=28b7a53b693f6b4e70218a926e68a36ece54cda1;hp=1336ff374a695918f9b11cb25813ca722f4b1abb;hpb=0912276c6467aa3ee6f570b31245367319da572a;p=tinc diff --git a/src/script.c b/src/script.c index 1336ff37..cb3d2934 100644 --- a/src/script.c +++ b/src/script.c @@ -1,7 +1,7 @@ /* script.c -- call an external script Copyright (C) 1999-2005 Ivo Timmermans, - 2000-2018 Guus Sliepen + 2000-2022 Guus Sliepen This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -80,7 +80,12 @@ int environment_add(environment_t *env, const char *format, ...) { if(format) { va_list ap; va_start(ap, format); - vasprintf(&env->entries[env->n], format, ap); + + if(vasprintf(&env->entries[env->n], format, ap) == -1) { + // Assume we are out of memory. + abort(); + } + va_end(ap); } else { env->entries[env->n] = NULL; @@ -93,7 +98,11 @@ void environment_update(environment_t *env, int pos, const char *format, ...) { free(env->entries[pos]); va_list ap; va_start(ap, format); - vasprintf(&env->entries[pos], format, ap); + + if(vasprintf(&env->entries[pos], format, ap) == -1) { + abort(); + } + va_end(ap); }