summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorColin Watson <cjwatson@debian.org>2022-12-31 23:01:03 +0000
committerColin Watson <cjwatson@debian.org>2022-12-31 23:01:04 +0000
commitcb0947a6a4bf24f091d3c8e635791a9c50d5d799 (patch)
tree2c2e144f4b19aa0ea57875925abb747b79f499ec
parent206b2ff154d0793b344abb09d5b4459e331554aa (diff)
Fix segfault when nroff is not installed
* src/man.c (try_section): Only free the `names` list if it is non-NULL due to `NROFF_MISSING` being defined, and return early if options are set such that cat files cannot be used either. * NEWS.md: Document this.
-rw-r--r--NEWS.md1
-rw-r--r--src/man.c5
2 files changed, 5 insertions, 1 deletions
diff --git a/NEWS.md b/NEWS.md
index 6aa4ff42..3c142df1 100644
--- a/NEWS.md
+++ b/NEWS.md
@@ -4,6 +4,7 @@ man-db 2.11.2
Fixes:
* Fix compile and test failures when `troff` is not `groff`.
+ * Fix segfault in typical uses of `man` when `nroff` is not installed.
man-db 2.11.1 (15 November 2022)
================================
diff --git a/src/man.c b/src/man.c
index 713f41ef..f072c75b 100644
--- a/src/man.c
+++ b/src/man.c
@@ -3182,12 +3182,15 @@ static int try_section (const char *path, const char *sec, const char *name,
return 1;
if (!troff && !want_encoding && !recode) {
- gl_list_free (names);
+ if (names)
+ gl_list_free (names);
names = look_for_file (path, sec, name, true,
lff_opts);
cat = 1;
}
}
+ if (!names)
+ return 0;
order_files (path, &names);