From: Ben Pfaff Date: Sun, 14 Apr 2024 16:48:23 +0000 (-0700) Subject: SHOW: Fix crash in SHOW TITLE and SHOW SUBTITLE if there is no (sub)title. X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6ebd6d64cf94d94dfc6dc47311536d4585d71b6a;p=pspp SHOW: Fix crash in SHOW TITLE and SHOW SUBTITLE if there is no (sub)title. Thanks to Zhou Geng for reporting this bug as poc14 in the report here: https://lists.gnu.org/archive/html/bug-gnu-pspp/2024-03/msg00015.html --- diff --git a/src/language/commands/set.c b/src/language/commands/set.c index c1792337b8..bca5521f4d 100644 --- a/src/language/commands/set.c +++ b/src/language/commands/set.c @@ -1028,7 +1028,7 @@ show_SPLIT (const struct dataset *ds) static char * show_SUBTITLE (const struct dataset *ds UNUSED) { - return xstrdup (output_get_subtitle ()); + return xstrdup_if_nonnull (output_get_subtitle ()); } static char * @@ -1040,7 +1040,7 @@ show_TEMPDIR (const struct dataset *ds UNUSED) static char * show_TITLE (const struct dataset *ds UNUSED) { - return xstrdup (output_get_title ()); + return xstrdup_if_nonnull (output_get_title ()); } static bool