From 282fe21ce6f22578f85b7b8addcd20b3f99f40fe Mon Sep 17 00:00:00 2001 From: Ingo Schwarze Date: Wed, 1 Aug 2018 13:46:15 +0000 Subject: Avoid a read access one byte beyond the end of an allocated string which occurred in situations like ".Fl a Cm --"; found by Leah Neukirchen with valgrind on Void Linux. --- NEWS | 6 +++--- mdoc_validate.c | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/NEWS b/NEWS index 2bd4fab7..a71e41ca 100644 --- a/NEWS +++ b/NEWS @@ -1,4 +1,4 @@ -$Id: NEWS,v 1.29 2018/07/31 15:34:00 schwarze Exp $ +$Id: NEWS,v 1.30 2018/08/01 13:46:15 schwarze Exp $ This file lists the most important changes in the mandoc.bsd.lv distribution. @@ -59,8 +59,8 @@ Changes in version 1.14.4, released on August XXX, 2018 on diagnostic messages and on the documentation. * Thomas Klausner (NetBSD) for suggesting two new style messages, one new feature, and for two bug reports. - * Leah Neukirchen (Void Linux) for suggesting a new style message - and for two bug reports. + * Leah Neukirchen (Void Linux) for suggesting a new style message, + four bug reports, and release testing. * Anthony Bentley (OpenBSD) for reporting multiple bugs and missing features. * Paul Irofti (OpenBSD) and Nate Bargmann for suggesting new features. diff --git a/mdoc_validate.c b/mdoc_validate.c index d455523e..f4381800 100644 --- a/mdoc_validate.c +++ b/mdoc_validate.c @@ -1,4 +1,4 @@ -/* $Id: mdoc_validate.c,v 1.358 2018/04/11 17:11:13 schwarze Exp $ */ +/* $Id: mdoc_validate.c,v 1.359 2018/08/01 13:46:15 schwarze Exp $ */ /* * Copyright (c) 2008-2012 Kristaps Dzonsons * Copyright (c) 2010-2018 Ingo Schwarze @@ -440,7 +440,7 @@ check_text_em(struct roff_man *mdoc, int ln, int pos, char *p) np->string != '\0' && isalpha((unsigned char)np->string[ strlen(np->string) - 1])) || - (cp[2] != '\0' ? + (cp[1] != '\0' && cp[2] != '\0' ? isalpha((unsigned char)cp[2]) : nn != NULL && nn->type == ROFFT_TEXT && -- cgit v1.2.3-56-ge451