From e96f4b343654ccf66696ae031e5479e8b497099f Mon Sep 17 00:00:00 2001 From: darealshinji Date: Wed, 20 Dec 2017 22:00:39 +0100 Subject: [PATCH] explicitly set terminating nul byte --- checkrt.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/checkrt.c b/checkrt.c index ef6dd80..3a97ae5 100644 --- a/checkrt.c +++ b/checkrt.c @@ -103,8 +103,10 @@ void checkrt(char *usr_in_appdir) bundle_gcc = 1; if (bundle_cxx == 1 || bundle_gcc == 1) { - optional_ld_preload = malloc(strlen("LD_PRELOAD=") + strlen(EXEC_SO) + 1 + len); + len = strlen(EXEC_SO) + 12 + len; + optional_ld_preload = malloc(len); sprintf(optional_ld_preload, "LD_PRELOAD=%s/" EXEC_SO, usr_in_appdir); + optional_ld_preload[len] = '\0'; } if (bundle_cxx == 1 && bundle_gcc == 0) {