From 20f1e3c7bcb6f037d20cc2c5eab6799faa292b8e Mon Sep 17 00:00:00 2001 From: Caleb Callaway Date: Sun, 22 Nov 2020 10:45:32 -0800 Subject: [PATCH] Fix percentage validation in CheckLength (#912) Fixes #910 --- src/attrs.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/attrs.c b/src/attrs.c index 3eae987..13c2668 100644 --- a/src/attrs.c +++ b/src/attrs.c @@ -1856,13 +1856,19 @@ void CheckLength( TidyDocImpl* doc, Node *node, AttVal *attval) } else { + Bool percentFound = no; while (*p) { - if (!TY_(IsDigit)(*p) && *p != '%') + if (!percentFound && *p == '%') + { + percentFound = yes; + } + else if (percentFound || !TY_(IsDigit)(*p)) { TY_(ReportAttrError)( doc, node, attval, BAD_ATTRIBUTE_VALUE); break; } + ++p; } }