diff options
Diffstat (limited to 'lib/dns/rcode.c')
-rw-r--r-- | lib/dns/rcode.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/lib/dns/rcode.c b/lib/dns/rcode.c index 18fedcd..81a4549 100644 --- a/lib/dns/rcode.c +++ b/lib/dns/rcode.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2010 Internet Systems Consortium, Inc. ("ISC") + * Copyright (C) 2004-2011 Internet Systems Consortium, Inc. ("ISC") * Copyright (C) 1998-2003 Internet Software Consortium. * * Permission to use, copy, modify, and/or distribute this software for any @@ -15,7 +15,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $Id: rcode.c,v 1.16 2010-12-23 04:07:58 marka Exp $ */ +/* $Id: rcode.c,v 1.16.14.2 2011-02-28 01:20:02 tbox Exp $ */ #include <config.h> #include <ctype.h> @@ -494,6 +494,9 @@ dns_rdataclass_format(dns_rdataclass_t rdclass, isc_result_t result; isc_buffer_t buf; + if (size == 0U) + return; + isc_buffer_init(&buf, array, size); result = dns_rdataclass_totext(rdclass, &buf); /* @@ -505,8 +508,6 @@ dns_rdataclass_format(dns_rdataclass_t rdclass, else result = ISC_R_NOSPACE; } - if (result != ISC_R_SUCCESS) { - snprintf(array, size, "<unknown>"); - array[size - 1] = '\0'; - } + if (result != ISC_R_SUCCESS) + strlcpy(array, "<unknown>", size); } |