No control characters, etc.
The old code allowed ANYTHING as dictionary names, which is bad.
{
size_t namelen;
static int max_attr = 0;
+ const char *p;
DICT_ATTR *attr;
namelen = strlen(name);
return -1;
}
+ for (p = name; *p != '\0'; p++) {
+ if (*p < ' ') {
+ fr_strerror_printf("dict_addattr: attribute name cannot contain control characters");
+ return -1;
+ }
+
+ if ((*p == '"') || (*p == '\\')) {
+ fr_strerror_printf("dict_addattr: attribute name cannot contain quotation or backslash");
+ return -1;
+ }
+
+ if ((*p == '<') || (*p == '>') || (*p == '&')) {
+ fr_strerror_printf("dict_addattr: attribute name cannot contain XML control characters");
+ return -1;
+ }
+ }
+
/*
* If the value is '-1', that means use a pre-existing
* one (if it already exists). If one does NOT already exist,