aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLibravatar Chiraag Nataraj <chiraag.nataraj@gmail.com>2017-07-30 14:27:11 -0400
committerLibravatar Chiraag Nataraj <chiraag.nataraj@gmail.com>2017-07-30 14:30:47 -0400
commit54c1f4d602fde45baae28aedb178db96856ea3f8 (patch)
treeffba5f72963ac07e6c255ddf0a12981cd1e59dee
parentRemove debugging stuff, free start_child, exit properly (diff)
downloadfirejail-54c1f4d602fde45baae28aedb178db96856ea3f8.tar.gz
firejail-54c1f4d602fde45baae28aedb178db96856ea3f8.tar.zst
firejail-54c1f4d602fde45baae28aedb178db96856ea3f8.zip
Ensure malloc was successful
-rw-r--r--src/firejail/x11.c6
1 files changed, 6 insertions, 0 deletions
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) {
685 char *start_child_prefix = "--start-child="; 685 char *start_child_prefix = "--start-child=";
686 char *start_child; 686 char *start_child;
687 start_child = malloc(total_length + strlen(start_child_prefix) + fpos + 2); 687 start_child = malloc(total_length + strlen(start_child_prefix) + fpos + 2);
688 if (start_child == NULL)
689 {
690 fprintf(stderr, "Error: unable to allocate start_child to assemble command\n");
691 exit(1);
692 }
693
688 strcpy(start_child,start_child_prefix); 694 strcpy(start_child,start_child_prefix);
689 for(i = 0; i < fpos; i++) { 695 for(i = 0; i < fpos; i++) {
690 strncat(start_child,firejail_argv[i],strlen(firejail_argv[i])); 696 strncat(start_child,firejail_argv[i],strlen(firejail_argv[i]));