diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/firejail/x11.c | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/src/firejail/x11.c b/src/firejail/x11.c index 204889625..74de24b47 100644 --- a/src/firejail/x11.c +++ b/src/firejail/x11.c | |||
@@ -641,6 +641,10 @@ static char * get_title_arg_str() { | |||
641 | if ((cfg.name != NULL) && (strlen(cfg.name) > 0)) { | 641 | if ((cfg.name != NULL) && (strlen(cfg.name) > 0)) { |
642 | 642 | ||
643 | title_arg_str = malloc(strlen(title_start) + strlen(title_sep) + strlen(cfg.name) + 1); | 643 | title_arg_str = malloc(strlen(title_start) + strlen(title_sep) + strlen(cfg.name) + 1); |
644 | if (title_arg_str == NULL) { | ||
645 | fprintf(stderr, "Error: malloc() failed to allocate memory\n"); | ||
646 | exit(1); | ||
647 | } | ||
644 | 648 | ||
645 | strcpy(title_arg_str, title_start); | 649 | strcpy(title_arg_str, title_start); |
646 | strcat(title_arg_str, title_sep); | 650 | strcat(title_arg_str, title_sep); |
@@ -650,10 +654,13 @@ static char * get_title_arg_str() { | |||
650 | // use the "--private" argument if it was explicitly specified | 654 | // use the "--private" argument if it was explicitly specified |
651 | else if ((cfg.home_private != NULL) && (strlen(cfg.home_private) > 0)) { | 655 | else if ((cfg.home_private != NULL) && (strlen(cfg.home_private) > 0)) { |
652 | 656 | ||
653 | char * tmp_in = strdupa(cfg.home_private); | 657 | const char * base_out = gnu_basename(cfg.home_private); |
654 | char * base_out = strdupa(basename(tmp_in)); | ||
655 | 658 | ||
656 | title_arg_str = malloc(strlen(title_start) + strlen(title_sep) + strlen(base_out) + 1); | 659 | title_arg_str = malloc(strlen(title_start) + strlen(title_sep) + strlen(base_out) + 1); |
660 | if (title_arg_str == NULL) { | ||
661 | fprintf(stderr, "Error: malloc() failed to allocate memory\n"); | ||
662 | exit(1); | ||
663 | } | ||
657 | 664 | ||
658 | strcpy(title_arg_str, title_start); | 665 | strcpy(title_arg_str, title_start); |
659 | strcat(title_arg_str, title_sep); | 666 | strcat(title_arg_str, title_sep); |
@@ -663,6 +670,10 @@ static char * get_title_arg_str() { | |||
663 | // default | 670 | // default |
664 | else { | 671 | else { |
665 | title_arg_str = malloc(strlen(title_start) + 1); | 672 | title_arg_str = malloc(strlen(title_start) + 1); |
673 | if (title_arg_str == NULL) { | ||
674 | fprintf(stderr, "Error: malloc() failed to allocate memory\n"); | ||
675 | exit(1); | ||
676 | } | ||
666 | 677 | ||
667 | strcpy(title_arg_str, title_start); | 678 | strcpy(title_arg_str, title_start); |
668 | } | 679 | } |