From 3c72c09b0b46063f51691bedeabc69413194fb61 Mon Sep 17 00:00:00 2001 From: Ingo Schwarze Date: Wed, 6 Feb 2019 21:11:43 +0000 Subject: Let roff_getname() end the roff identifier at a tab character and audit all its callers whether termination is handled correctly. Resulting improvements: * An escape or tab ending the macro name in a macro invocation is discarded, and argument processing is started after it. * An escape or tab ending a name in ".if d" and ".if r" is preserved. * An escape ending a name in ".ds" causes the whole request to be ignored. * A tab ending a name in ".ds" becomes part of the string. * An escape or tab ending a name in ".rm" causes the rest of the line to be ignored. * An escape or tab ending the first name in ".als", ".rn", or ".nr" causes the whole request to be ignored. Kurt Jaeger made me aware of https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=235456#c0 and in that bug report, comment 0 item (3) is a special case of this class of issues. Yes, the "mh" manual pages are no doubt among the worst on the planet. --- regress/roff/ds/Makefile | 4 ++-- regress/roff/ds/tab.in | 10 ++++++++++ regress/roff/ds/tab.out_ascii | 9 +++++++++ 3 files changed, 21 insertions(+), 2 deletions(-) create mode 100644 regress/roff/ds/tab.in create mode 100644 regress/roff/ds/tab.out_ascii (limited to 'regress/roff/ds') diff --git a/regress/roff/ds/Makefile b/regress/roff/ds/Makefile index 98a93d75..773105e8 100644 --- a/regress/roff/ds/Makefile +++ b/regress/roff/ds/Makefile @@ -1,5 +1,5 @@ -# $OpenBSD: Makefile,v 1.5 2014/06/29 22:12:54 schwarze Exp $ +# $OpenBSD: Makefile,v 1.6 2019/02/06 20:54:28 schwarze Exp $ -REGRESS_TARGETS = append escname nested quoting +REGRESS_TARGETS = append escname nested quoting tab .include diff --git a/regress/roff/ds/tab.in b/regress/roff/ds/tab.in new file mode 100644 index 00000000..62c806f3 --- /dev/null +++ b/regress/roff/ds/tab.in @@ -0,0 +1,10 @@ +.\" $OpenBSD: tab.in,v 1.1 2019/02/06 20:54:28 schwarze Exp $ +.Dd $Mdocdate: February 6 2019 $ +.Dt DS-TAB 1 +.Os +.Sh NAME +.Nm ds-tab +.Nd tab characters in string definition lines +.Sh DESCRIPTION +.ds teststr myval +>>\*[teststr]<< diff --git a/regress/roff/ds/tab.out_ascii b/regress/roff/ds/tab.out_ascii new file mode 100644 index 00000000..aa0507a6 --- /dev/null +++ b/regress/roff/ds/tab.out_ascii @@ -0,0 +1,9 @@ +DS-TAB(1) General Commands Manual DS-TAB(1) + +NNAAMMEE + ddss--ttaabb - tab characters in string definition lines + +DDEESSCCRRIIPPTTIIOONN + >> myval<< + +OpenBSD February 6, 2019 OpenBSD -- cgit v1.2.3-56-ge451