* mandoc: Fix an off-by-one string read access that could happen if an
@ 2018-08-01 16:01 schwarze
0 siblings, 0 replies; only message in thread
From: schwarze @ 2018-08-01 16:01 UTC (permalink / raw)
To: source
Log Message:
-----------
Fix an off-by-one string read access that could happen if an empty
string argument preceded a string argument beginning with "--".
Found by Leah Neukirchen <leah at vuxu dot org> with -Wpointer-compare.
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.359
retrieving revision 1.360
diff -Lmdoc_validate.c -Lmdoc_validate.c -u -p -r1.359 -r1.360
--- mdoc_validate.c
+++ mdoc_validate.c
@@ -437,14 +437,13 @@ check_text_em(struct roff_man *mdoc, int
isalpha((unsigned char)cp[-3]) :
np != NULL &&
np->type == ROFFT_TEXT &&
- np->string != '\0' &&
+ *np->string != '\0' &&
isalpha((unsigned char)np->string[
strlen(np->string) - 1])) ||
(cp[1] != '\0' && cp[2] != '\0' ?
isalpha((unsigned char)cp[2]) :
nn != NULL &&
nn->type == ROFFT_TEXT &&
- nn->string != '\0' &&
isalpha((unsigned char)*nn->string))) {
mandoc_msg(MANDOCERR_DASHDASH, mdoc->parse,
ln, pos + (int)(cp - p) - 1, NULL);
--
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-08-01 16:01 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-08-01 16:01 mandoc: Fix an off-by-one string read access that could happen if an 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).