source@mandoc.bsd.lv
 help / color / mirror / Atom feed
* mandoc: Ouch, fix previous:  In the edge case of a single-character
@ 2018-03-16 20:42 schwarze
  0 siblings, 0 replies; only message in thread
From: schwarze @ 2018-03-16 20:42 UTC (permalink / raw)
  To: source

Log Message:
-----------
Ouch, fix previous:  In the edge case of a single-character string
containing nothing but a single hyphen, the pointer got incremented
twice at one point, causing a read overrun found by naddy@.

Modified Files:
--------------
    mandoc:
        mdoc_validate.c

Revision Data
-------------
Index: mdoc_validate.c
===================================================================
RCS file: /home/cvs/mandoc/mandoc/mdoc_validate.c,v
retrieving revision 1.355
retrieving revision 1.356
diff -Lmdoc_validate.c -Lmdoc_validate.c -u -p -r1.355 -r1.356
--- mdoc_validate.c
+++ mdoc_validate.c
@@ -412,8 +412,9 @@ check_text_em(struct roff_man *mdoc, int
 	/* Look for em-dashes wrongly encoded as "--". */
 
 	for (cp = p; *cp != '\0'; cp++) {
-		if (*cp != '-' || *++cp != '-')
+		if (cp[0] != '-' || cp[1] != '-')
 			continue;
+		cp++;
 
 		/* Skip input sequences of more than two '-'. */
 
--
 To unsubscribe send an email to source+unsubscribe@mandoc.bsd.lv

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2018-03-16 20:42 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-03-16 20:42 mandoc: Ouch, fix previous: In the edge case of a single-character schwarze

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).