1
0
mirror of https://github.com/openbsd/src.git synced 2026-04-23 21:54:32 +00:00

fix crash on invalid tags file

If the tag entry points to the line number zero, less crashes because
internally it uses that line number to imply that the tag is associated
with a pattern.

issue reported by Henry Ford (henryfordkjv at gmail), thanks!

ok kirill@
This commit is contained in:
op
2026-04-05 23:17:30 +00:00
parent 8a4a3a78bb
commit 5ca605e59d

View File

@@ -260,6 +260,10 @@ findctag(char *tag)
*/
tagendline = 0;
taglinenum = getnum(&p, 0, &err);
if (!err && taglinenum <= 0) {
/* line numbers must be positive */
continue;
}
if (err) {
/*
* No, it must be a pattern.