From ad652490d47916a27c01e3dd8f9eafcecbb4bc7f Mon Sep 17 00:00:00 2001 From: Daniel Golle Date: Fri, 18 Feb 2022 20:41:02 +0000 Subject: [PATCH] instance: exit in case asprintf() fails If asprintf returns -1 we are most likely out of memory, so just exit in that case. Signed-off-by: Daniel Golle --- service/instance.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/service/instance.c b/service/instance.c index 9c74265..8202d65 100644 --- a/service/instance.c +++ b/service/instance.c @@ -295,7 +295,9 @@ jail_run(struct service_instance *in, char **argv) argv[argc++] = UJAIL_BIN_PATH; - asprintf(&term_timeout_str, "%d", in->term_timeout); + if (asprintf(&term_timeout_str, "%d", in->term_timeout) == -1) + exit(ENOMEM); + argv[argc++] = "-t"; argv[argc++] = term_timeout_str; -- 2.30.2