diff options
author | Ingo Schwarze <schwarze@openbsd.org> | 2021-05-18 13:22:43 +0000 |
---|---|---|
committer | Ingo Schwarze <schwarze@openbsd.org> | 2021-05-18 13:22:43 +0000 |
commit | 18a2377a6ac623081a6248d7d1aba4a47d5c20bc (patch) | |
tree | 7f18dbccfa8e03659557f0b62a877ce1e39c371d | |
parent | 9480da153087d5a237b7dafa2edbe172e9db2f0d (diff) | |
download | mandoc-18a2377a6ac623081a6248d7d1aba4a47d5c20bc.tar.gz |
When looking for column separators on tbl(7) data lines, properly skip
escape sequences; do not misinterpret bytes from the middle of escape
sequence names or arguments as column separators.
Bug reported and patch tested by Oliver dot Corff at email dot de.
-rw-r--r-- | tbl_data.c | 10 |
1 files changed, 7 insertions, 3 deletions
@@ -1,7 +1,7 @@ /* $Id$ */ /* * Copyright (c) 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv> - * Copyright (c) 2011,2015,2017,2018,2019 Ingo Schwarze <schwarze@openbsd.org> + * Copyright (c) 2011,2015,2017-2019,2021 Ingo Schwarze <schwarze@openbsd.org> * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above @@ -46,6 +46,7 @@ getdata(struct tbl_node *tbl, struct tbl_span *dp, struct tbl_dat *dat, *pdat; struct tbl_cell *cp; struct tbl_span *pdp; + const char *ccp; int sv; /* @@ -54,8 +55,11 @@ getdata(struct tbl_node *tbl, struct tbl_span *dp, */ sv = *pos; - while (p[*pos] != '\0' && p[*pos] != tbl->opts.tab) - (*pos)++; + ccp = p + sv; + while (*ccp != '\0' && *ccp != tbl->opts.tab) + if (*ccp++ == '\\') + mandoc_escape(&ccp, NULL, NULL); + *pos = ccp - p; /* Advance to the next layout cell, skipping spanners. */ |