Skip to content

Commit 20f1e3c

Browse files
authored
Fix percentage validation in CheckLength (htacg#912)
Fixes htacg#910
1 parent c0e6d68 commit 20f1e3c

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/attrs.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1856,13 +1856,19 @@ void CheckLength( TidyDocImpl* doc, Node *node, AttVal *attval)
18561856
}
18571857
else
18581858
{
1859+
Bool percentFound = no;
18591860
while (*p)
18601861
{
1861-
if (!TY_(IsDigit)(*p) && *p != '%')
1862+
if (!percentFound && *p == '%')
1863+
{
1864+
percentFound = yes;
1865+
}
1866+
else if (percentFound || !TY_(IsDigit)(*p))
18621867
{
18631868
TY_(ReportAttrError)( doc, node, attval, BAD_ATTRIBUTE_VALUE);
18641869
break;
18651870
}
1871+
18661872
++p;
18671873
}
18681874
}

0 commit comments

Comments
 (0)