Validate vendor attribute names.
@@ -1236,6 +1236,7 @@ validate_driver(
bool ret = true; // Return value
int i, // Looping variable
num_icons; // Number of printer icons
+ const char *venptr; // Pointer into vendor name
static const char * const icon_sizes[] =
{ // Icon sizes
"small-48x48",
@@ -1365,6 +1366,23 @@ validate_driver(
}
}
+ for (i = 0; i < data->num_vendor; i ++)
+ {
+ for (venptr = data->vendor[i]; *venptr; venptr ++)
+ {
+ int vench = *venptr & 255; // Current character
+
+ if (!isalnum(vench) && vench != '-' && vench != '_')
+ break;
+ }
+
+ if (*venptr)
+ {
+ papplLogPrinter(printer, PAPPL_LOGLEVEL_FATAL, "Invalid vendor attribute name '%s'.", data->vendor[i]);
+ ret = false;
+ }
+ }
+
return (ret);
}
