For #909: Numeric truncation when parsing TYPEXX and CLASSXX representation

- Fix return values.
- Formatting nits.
This commit is contained in:
George Thessalonikefs
2023-07-20 11:42:05 +02:00
parent d29bc712b1
commit 5b7faca7db
4 changed files with 17 additions and 10 deletions
+7 -3
View File
@@ -132,10 +132,14 @@ write_q(int fd, int udp, SSL* ssl, sldns_buffer* buf, uint16_t id,
/* qtype and qclass */
qinfo.qtype = sldns_get_rr_type_by_name(strtype);
if(qinfo.qtype == 0 && strcmp(strtype, "TYPE0") != 0) {
printf("cannot parse query type: '%s'\n", strtype);
exit(1);
}
qinfo.qclass = sldns_get_rr_class_by_name(strclass);
if((qinfo.qtype == 0 && strcmp(strtype, "TYPE0") != 0) ||
(qinfo.qclass == 0 && strcmp(strclass, "CLASS0") != 0)) {
return 0;
if(qinfo.qclass == 0 && strcmp(strclass, "CLASS0") != 0) {
printf("cannot parse query class: '%s'\n", strclass);
exit(1);
}
/* clear local alias */