diff options
author | Doug Barton <dougb@FreeBSD.org> | 2011-08-02 05:18:50 +0000 |
---|---|---|
committer | Doug Barton <dougb@FreeBSD.org> | 2011-08-02 05:18:50 +0000 |
commit | 0842d663b7cfb84b478ec937fc1dbc640ceae92b (patch) | |
tree | 4385ddab756952a705f233916d0536e76fe9cc58 /lib/dns/rcode.c | |
parent | 6a50a75ead6b2f11f0321914c033e8c8670cbb60 (diff) |
Notes
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 2dc0a293ea29..61c9faab06c0 100644 --- a/lib/dns/rcode.c +++ b/lib/dns/rcode.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2008, 2010 Internet Systems Consortium, Inc. ("ISC") + * Copyright (C) 2004-2008, 2010, 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.8.48.2 2010-01-15 23:47:33 tbox Exp $ */ +/* $Id: rcode.c,v 1.8.48.4 2011-02-21 23:45:49 tbox Exp $ */ #include <config.h> #include <ctype.h> @@ -473,6 +473,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); /* @@ -484,8 +487,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); } |