| | @@ -4538,11 +4538,12 @@ |
| 4538 | 4538 | /* |
| 4539 | 4539 | ** Given a string and its length, returns true if the string begins |
| 4540 | 4540 | ** with a construct which syntactically matches an HTML entity escape |
| 4541 | 4541 | ** sequence (without checking for whether it's a known entity). Always |
| 4542 | 4542 | ** returns false if zText[0] is false or n<4. Entities match the |
| 4543 | | -** equivalent of the regexes `&#[0-9]+;` and `&[a-zA-Z]+;`. |
| 4543 | +** equivalent of the regexes `&#[0-9]{2,};` and |
| 4544 | +** `&[a-zA-Z][a-zA-Z0-9]+;`. |
| 4544 | 4545 | */ |
| 4545 | 4546 | static int pik_isentity(char const * zText, int n){ |
| 4546 | 4547 | int i = 0; |
| 4547 | 4548 | if( n<4 || '&'!=zText[0] ) return 0; |
| 4548 | 4549 | n--; |
| | @@ -4551,15 +4552,18 @@ |
| 4551 | 4552 | zText++; |
| 4552 | 4553 | n--; |
| 4553 | 4554 | for(i=0; i<n; i++){ |
| 4554 | 4555 | if( i>1 && ';'==zText[i] ) return 1; |
| 4555 | 4556 | else if( zText[i]<'0' || zText[i]>'9' ) return 0; |
| 4557 | + /* Note that &#nn; values nn<32d are not legal entities. */ |
| 4556 | 4558 | } |
| 4557 | 4559 | }else{ |
| 4558 | | - for( i=0; i<n; i++ ){ |
| 4560 | + for(i=0; i<n; i++){ |
| 4559 | 4561 | if( i>1 && ';'==zText[i] ) return 1; |
| 4560 | | - else if( zText[i]<'A' || zText[i]>'z' |
| 4562 | + else if( i>0 && zText[i]>='0' && zText[i]<='9' ){ |
| 4563 | + continue; |
| 4564 | + }else if( zText[i]<'A' || zText[i]>'z' |
| 4561 | 4565 | || (zText[i]>'Z' && zText[i]<'a') ) return 0; |
| 4562 | 4566 | } |
| 4563 | 4567 | } |
| 4564 | 4568 | return 0; |
| 4565 | 4569 | } |
| | @@ -8127,6 +8131,6 @@ |
| 8127 | 8131 | |
| 8128 | 8132 | |
| 8129 | 8133 | #endif /* PIKCHR_TCL */ |
| 8130 | 8134 | |
| 8131 | 8135 | |
| 8132 | | -#line 8157 "pikchr.c" |
| 8136 | +#line 8161 "pikchr.c" |
| 8133 | 8137 | |