commit cdf2acbc7bac34098114561a45ab9eee049b05ba
parent a3262c7d7d442b2b8af458cf00d1086917d5f65d
Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date: Sat, 1 Aug 2015 00:33:10 +0200
xml: only allow full uppercase or full lowercase for entities
Diffstat:
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git 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 = ">", .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;