From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from localhost (fantadrom.bsd.lv [local]) by fantadrom.bsd.lv (OpenSMTPD) with ESMTPA id afc1a247 for ; Fri, 3 May 2019 13:24:24 -0500 (EST) Date: Fri, 3 May 2019 13:24:24 -0500 (EST) X-Mailinglist: mandoc-source Reply-To: source@mandoc.bsd.lv MIME-Version: 1.0 From: schwarze@mandoc.bsd.lv To: source@mandoc.bsd.lv Subject: mandoc: when processing unknown output options, prevent passing NULL to X-Mailer: activitymail 1.26, http://search.cpan.org/dist/activitymail/ Content-Type: text/plain; charset=utf-8 Message-ID: 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