source@mandoc.bsd.lv
 help / color / Atom feed
* mandoc: when processing unknown output options, prevent passing NULL to 
@ 2019-05-03 18:24 schwarze
  0 siblings, 0 replies; only message in thread
From: schwarze @ 2019-05-03 18:24 UTC (permalink / raw)
  To: source

Log Message:
-----------
when processing unknown output options, prevent passing NULL to printf;
patch from anton@

Modified Files:
--------------
    mandoc:
        manpath.c

Revision Data
-------------
Index: manpath.c
===================================================================
RCS file: /home/cvs/mandoc/mandoc/manpath.c,v
retrieving revision 1.37
retrieving revision 1.38
diff -Lmanpath.c -Lmanpath.c -u -p -r1.37 -r1.38
--- manpath.c
+++ manpath.c
@@ -235,12 +235,13 @@ manconf_output(struct manoutput *conf, c
 	    "includes", "man", "paper", "style", "indent", "width",
 	    "tag", "fragment", "mdoc", "noval", "toc"
 	};
+	const size_t ntoks = sizeof(toks) / sizeof(toks[0]);
 
 	const char	*errstr;
 	char		*oldval;
 	size_t		 len, tok;
 
-	for (tok = 0; tok < sizeof(toks)/sizeof(toks[0]); tok++) {
+	for (tok = 0; tok < ntoks; tok++) {
 		len = strlen(toks[tok]);
 		if ( ! strncmp(cp, toks[tok], len) &&
 		    strchr(" =	", cp[len]) != NULL) {
@@ -257,7 +258,7 @@ manconf_output(struct manoutput *conf, c
 		warnx("-O %s=?: Missing argument value", toks[tok]);
 		return -1;
 	}
-	if (tok > 6 && *cp != '\0') {
+	if (tok > 6 && tok < ntoks && *cp != '\0') {
 		warnx("-O %s: Does not take a value: %s", toks[tok], cp);
 		return -1;
 	}
--
 To unsubscribe send an email to source+unsubscribe@mandoc.bsd.lv

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

only message in thread, back to index

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-05-03 18:24 mandoc: when processing unknown output options, prevent passing NULL to schwarze

source@mandoc.bsd.lv

Archives are clonable: git clone --mirror http://inbox.vuxu.org/mandoc-source

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://inbox.vuxu.org/vuxu.archive.mandoc.source


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git