diff options
Diffstat (limited to 'lib/dns/rcode.c')
-rw-r--r-- | lib/dns/rcode.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/lib/dns/rcode.c b/lib/dns/rcode.c index 69007f881efd..2fdb751e6dbf 100644 --- a/lib/dns/rcode.c +++ b/lib/dns/rcode.c @@ -212,11 +212,13 @@ maybe_numeric(unsigned int *valuep, isc_textregion_t *source, return (ISC_R_BADNUMBER); /* - * We have a potential number. Try to parse it with - * isc_parse_uint32(). isc_parse_uint32() requires + * We have a potential number. Try to parse it with + * isc_parse_uint32(). isc_parse_uint32() requires * null termination, so we must make a copy. */ - strncpy(buffer, source->base, NUMBERSIZE); + strncpy(buffer, source->base, sizeof(buffer)); + buffer[sizeof(buffer) - 1] = '\0'; + INSIST(buffer[source->length] == '\0'); result = isc_parse_uint32(&n, buffer, 10); |