version 1.174, 2014/09/28 20:14:20 |
version 1.178, 2014/10/27 13:31:04 |
|
|
/* $Id$ */ |
/* $Id$ */ |
/* |
/* |
* Copyright (c) 2008, 2009, 2010, 2011, 2014 Kristaps Dzonsons <kristaps@bsd.lv> |
* Copyright (c) 2008-2011, 2014 Kristaps Dzonsons <kristaps@bsd.lv> |
* Copyright (c) 2011, 2012, 2013, 2014 Ingo Schwarze <schwarze@openbsd.org> |
* Copyright (c) 2011, 2012, 2013, 2014 Ingo Schwarze <schwarze@openbsd.org> |
* |
* |
* Permission to use, copy, modify, and distribute this software for any |
* Permission to use, copy, modify, and distribute this software for any |
Line 105 static const char *const htmlattrs[ATTR_MAX] = { |
|
Line 105 static const char *const htmlattrs[ATTR_MAX] = { |
|
"charset", /* ATTR_CHARSET */ |
"charset", /* ATTR_CHARSET */ |
"open", /* ATTR_OPEN */ |
"open", /* ATTR_OPEN */ |
"close", /* ATTR_CLOSE */ |
"close", /* ATTR_CLOSE */ |
|
"mathvariant", /* ATTR_MATHVARIANT */ |
}; |
}; |
|
|
static const char *const roffscales[SCALE_MAX] = { |
static const char *const roffscales[SCALE_MAX] = { |
Line 436 print_encode(struct html *h, const char *p, int norecu |
|
Line 437 print_encode(struct html *h, const char *p, int norecu |
|
case ESCAPE_UNICODE: |
case ESCAPE_UNICODE: |
/* Skip past "u" header. */ |
/* Skip past "u" header. */ |
c = mchars_num2uc(seq + 1, len - 1); |
c = mchars_num2uc(seq + 1, len - 1); |
if ('\0' != c) |
|
printf("&#x%x;", c); |
/* |
|
* XXX Security warning: |
|
* For now, forbid Unicode obfuscation of ASCII |
|
* characters. An audit of the callers is |
|
* required before this can be removed. |
|
*/ |
|
|
|
if (c < 0x80) |
|
c = 0xFFFD; |
|
|
|
printf("&#x%x;", c); |
break; |
break; |
case ESCAPE_NUMBERED: |
case ESCAPE_NUMBERED: |
c = mchars_num2char(seq, len); |
c = mchars_num2char(seq, len); |
Line 446 print_encode(struct html *h, const char *p, int norecu |
|
Line 457 print_encode(struct html *h, const char *p, int norecu |
|
break; |
break; |
case ESCAPE_SPECIAL: |
case ESCAPE_SPECIAL: |
c = mchars_spec2cp(h->symtab, seq, len); |
c = mchars_spec2cp(h->symtab, seq, len); |
if (c > 0) |
if (c <= 0) |
|
break; |
|
if (c < 0x20 || c > 0x7e) |
printf("&#%d;", c); |
printf("&#%d;", c); |
else if (-1 == c && 1 == len && |
else if ( ! print_escape(c)) |
!print_escape(*seq)) |
putchar(c); |
putchar((int)*seq); |
|
break; |
break; |
case ESCAPE_NOSPACE: |
case ESCAPE_NOSPACE: |
if ('\0' == *p) |
if ('\0' == *p) |