aboutsummaryrefslogtreecommitdiff
path: root/contrib/unbound/sldns/rrdef.c
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/unbound/sldns/rrdef.c')
-rw-r--r--contrib/unbound/sldns/rrdef.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/contrib/unbound/sldns/rrdef.c b/contrib/unbound/sldns/rrdef.c
index 322eff096c03..e81ebb1fc434 100644
--- a/contrib/unbound/sldns/rrdef.c
+++ b/contrib/unbound/sldns/rrdef.c
@@ -702,7 +702,11 @@ sldns_get_rr_type_by_name(const char *name)
/* TYPEXX representation */
if (strlen(name) > 4 && strncasecmp(name, "TYPE", 4) == 0) {
- return atoi(name + 4);
+ unsigned int a = atoi(name + 4);
+ if (a > LDNS_RR_TYPE_LAST) {
+ return (enum sldns_enum_rr_type)0;
+ }
+ return a;
}
/* Normal types */
@@ -740,7 +744,11 @@ sldns_get_rr_class_by_name(const char *name)
/* CLASSXX representation */
if (strlen(name) > 5 && strncasecmp(name, "CLASS", 5) == 0) {
- return atoi(name + 5);
+ unsigned int a = atoi(name + 5);
+ if (a > LDNS_RR_CLASS_LAST) {
+ return (enum sldns_enum_rr_class)0;
+ }
+ return a;
}
/* Normal types */