---
src/conf/domain_conf.c | 24 ++++++++++++++++++++++++
1 file changed, 24 insertions(+)
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index a8b5dfd..43273f8 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -11591,6 +11591,30 @@ virDomainDefParseXML(xmlDocPtr xml,
goto error;
}
}
+ if (def->sysinfo->bios_date != NULL) {
+ char *date = def->sysinfo->bios_date;
+ char *ptr;
+ struct tm tm;
+ memset(&tm, 0, sizeof(tm));
+
+ /* Validate just the format of the date
+ * Expect mm/dd/yyyy or mm/dd/yy,
+ * where yy must be 00->99 and would be assumed to be 19xx
+ * a yyyy date should be 1900 and beyond
+ */
+ if (virStrToLong_i(date, &ptr, 10, &tm.tm_mon) < 0 ||
+ *ptr != '/' ||
+ virStrToLong_i(ptr+1, &ptr, 10, &tm.tm_mday) < 0 ||
+ *ptr != '/' ||
+ virStrToLong_i(ptr+1, &ptr, 10, &tm.tm_year) < 0 ||
+ *ptr != '\0' ||
+ (tm.tm_year < 0 || (tm.tm_year >= 100 && tm.tm_year <
1900))) {
+ virReportError(VIR_ERR_INTERNAL_ERROR,
+ _("Invalid BIOS 'date' format: %s"),
+ def->sysinfo->bios_date);
+ goto error;
+ }
+ }
}
if ((tmp = virXPathString("string(./os/smbios/@mode)", ctxt))) {
--
1.8.1.4