fix numtrunc in str2wire.c

This commit is contained in:
headshog 2023-07-11 18:44:31 +03:00
parent 7240ecbeb0
commit 78c284e05d

View file

@ -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_TYPE_LAST) {
return (enum sldns_enum_rr_type)0;
}
return a;
}
/* Normal types */