summaryrefslogtreecommitdiff
path: root/usr.sbin/bind/lib/dns/rdata.c
diff options
context:
space:
mode:
Diffstat (limited to 'usr.sbin/bind/lib/dns/rdata.c')
-rw-r--r--usr.sbin/bind/lib/dns/rdata.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/usr.sbin/bind/lib/dns/rdata.c b/usr.sbin/bind/lib/dns/rdata.c
index cb696841f85..3fddd4ea445 100644
--- a/usr.sbin/bind/lib/dns/rdata.c
+++ b/usr.sbin/bind/lib/dns/rdata.c
@@ -976,7 +976,7 @@ dns_mnemonic_fromtext(unsigned int *valuep, isc_textregion_t *source,
* strtoul() requires null termination, so we must make
* a copy.
*/
- strncpy(buffer, source->base, NUMBERSIZE);
+ strlcpy(buffer, source->base, NUMBERSIZE);
INSIST(buffer[source->length] == '\0');
n = strtoul(buffer, &e, 10);
@@ -1053,8 +1053,7 @@ dns_rdataclass_fromtext(dns_rdataclass_t *classp, isc_textregion_t *source) {
char *endp;
unsigned int val;
- strncpy(buf, source->base + 5, source->length - 5);
- buf[source->length - 5] = '\0';
+ strlcpy(buf, source->base + 5, sizeof(buf));
val = strtoul(buf, &endp, 10);
if (*endp == '\0' && val <= 0xffff) {
*classp = (dns_rdataclass_t)val;
@@ -1158,8 +1157,7 @@ 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';
+ strlcpy(buf, source->base + 4, sizeof(buf));
val = strtoul(buf, &endp, 10);
if (*endp == '\0' && val <= 0xffff) {
*typep = (dns_rdatatype_t)val;
@@ -1290,7 +1288,7 @@ dns_keyflags_fromtext(dns_keyflags_t *flagsp, isc_textregion_t *source)
* strtoul() requires null termination, so we must make
* a copy.
*/
- strncpy(buffer, source->base, NUMBERSIZE);
+ strlcpy(buffer, source->base, NUMBERSIZE);
INSIST(buffer[source->length] == '\0');
n = strtoul(buffer, &e, 0); /* Allow hex/octal. */