mirror of
https://gitlab.isc.org/isc-projects/bind9
synced 2025-08-31 22:45:39 +00:00
more str{n}{cat,cpy} corrections rt45981_stage2
This commit is contained in:
@@ -1339,8 +1339,12 @@ dns_rdatatype_fromtext(dns_rdatatype_t *typep, isc_textregion_t *source) {
|
||||
char *endp;
|
||||
unsigned int val;
|
||||
|
||||
strncpy(buf, source->base + 4, source->length - 4);
|
||||
buf[source->length - 4] = '\0';
|
||||
/*
|
||||
* source->base is not required to be NUL terminated.
|
||||
* Copy up to remaining bytes and NUL terminate.
|
||||
*/
|
||||
strlcpy(buf, source->base + 4,
|
||||
ISC_MIN(source->length - 4 + 1, sizeof(buf)));
|
||||
val = strtoul(buf, &endp, 10);
|
||||
if (*endp == '\0' && val <= 0xffff) {
|
||||
*typep = (dns_rdatatype_t)val;
|
||||
|
Reference in New Issue
Block a user