2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-08-31 14:35:26 +00:00

don't use strlcat with non NUL terminated strings rt45981_stage3

This commit is contained in:
Mark Andrews
2017-09-15 13:14:16 +10:00
parent bdd3edceb9
commit dc71aa898a
3 changed files with 7 additions and 7 deletions

View File

@@ -1343,8 +1343,8 @@ dns_rdatatype_fromtext(dns_rdatatype_t *typep, isc_textregion_t *source) {
* 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)));
snprintf(buf, sizeof(buf), "%.*s",
(int)(source->length - 4), source->base + 4);
val = strtoul(buf, &endp, 10);
if (*endp == '\0' && val <= 0xffff) {
*typep = (dns_rdatatype_t)val;