diff options
author | Hiltjo Posthuma <hiltjo@codemadness.org> | 2015-08-01 00:33:10 +0200 |
---|---|---|
committer | Hiltjo Posthuma <hiltjo@codemadness.org> | 2015-08-01 00:33:10 +0200 |
commit | cdf2acbc7bac34098114561a45ab9eee049b05ba (patch) | |
tree | 76b830f961d8e1893de9741f54302df463971559 | |
parent | a3262c7d7d442b2b8af458cf00d1086917d5f65d (diff) |
xml: only allow full uppercase or full lowercase for entities
-rw-r--r-- | xml.c | 10 |
1 files changed, 7 insertions, 3 deletions
@@ -4,7 +4,6 @@ #include <stdio.h> #include <stdlib.h> #include <string.h> -#include <strings.h> #include <unistd.h> #include "xml.h" @@ -18,7 +17,12 @@ static const struct { { .entity = ">", .len = 4, .c = '>' }, { .entity = "'", .len = 6, .c = '\'' }, { .entity = "&", .len = 5, .c = '&' }, - { .entity = """, .len = 6, .c = '"' } + { .entity = """, .len = 6, .c = '"' }, + { .entity = "<", .len = 4, .c = '<' }, + { .entity = ">", .len = 4, .c = '>' }, + { .entity = "&APOS;", .len = 6, .c = '\'' }, + { .entity = "&", .len = 5, .c = '&' }, + { .entity = """, .len = 6, .c = '"' } }; static int @@ -287,7 +291,7 @@ xml_namedentitytostr(const char *e, char *buf, size_t bufsiz) for (i = 0; i < sizeof(entities) / sizeof(*entities); i++) { /* NOTE: compares max 6 chars */ - if (!strncasecmp(e, entities[i].entity, 6)) { + if (!strncmp(e, entities[i].entity, 6)) { buf[0] = entities[i].c; buf[1] = '\0'; return 1; |