summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHiltjo Posthuma <hiltjo@codemadness.org>2015-08-01 00:33:10 +0200
committerHiltjo Posthuma <hiltjo@codemadness.org>2015-08-01 00:33:10 +0200
commitcdf2acbc7bac34098114561a45ab9eee049b05ba (patch)
tree76b830f961d8e1893de9741f54302df463971559
parenta3262c7d7d442b2b8af458cf00d1086917d5f65d (diff)
xml: only allow full uppercase or full lowercase for entities
-rw-r--r--xml.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/xml.c b/xml.c
index c33ca0c..ed09a27 100644
--- a/xml.c
+++ b/xml.c
@@ -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 = "&gt;", .len = 4, .c = '>' },
{ .entity = "&apos;", .len = 6, .c = '\'' },
{ .entity = "&amp;", .len = 5, .c = '&' },
- { .entity = "&quot;", .len = 6, .c = '"' }
+ { .entity = "&quot;", .len = 6, .c = '"' },
+ { .entity = "&LT;", .len = 4, .c = '<' },
+ { .entity = "&GT;", .len = 4, .c = '>' },
+ { .entity = "&APOS;", .len = 6, .c = '\'' },
+ { .entity = "&AMP;", .len = 5, .c = '&' },
+ { .entity = "&QUOT;", .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;