From 54c1f4d602fde45baae28aedb178db96856ea3f8 Mon Sep 17 00:00:00 2001 From: Chiraag Nataraj Date: Sun, 30 Jul 2017 14:27:11 -0400 Subject: Ensure malloc was successful --- src/firejail/x11.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/firejail/x11.c b/src/firejail/x11.c index d7b50e936..7b21c2209 100644 --- a/src/firejail/x11.c +++ b/src/firejail/x11.c @@ -685,6 +685,12 @@ void x11_start_xpra(int argc, char **argv) { char *start_child_prefix = "--start-child="; char *start_child; start_child = malloc(total_length + strlen(start_child_prefix) + fpos + 2); + if (start_child == NULL) + { + fprintf(stderr, "Error: unable to allocate start_child to assemble command\n"); + exit(1); + } + strcpy(start_child,start_child_prefix); for(i = 0; i < fpos; i++) { strncat(start_child,firejail_argv[i],strlen(firejail_argv[i])); -- cgit v1.2.3-70-g09d2