diff options
author | Shawn Routhier <sar@isc.org> | 2008-12-02 19:49:09 +0000 |
---|---|---|
committer | Shawn Routhier <sar@isc.org> | 2008-12-02 19:49:09 +0000 |
commit | a1f7c59ad390133e490c3ce49c4081b480b76876 (patch) | |
tree | 50712c831dd3d2c0e23fe9beae8e09f0dbd40e1b | |
parent | cb05881540651a647be65797cba16cf63106d363 (diff) | |
download | isc-dhcp-a1f7c59ad390133e490c3ce49c4081b480b76876.tar.gz |
Bug fix for 18174 - bring domain-search processing into line with 4.x
-rw-r--r-- | common/options.c | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/common/options.c b/common/options.c index 0ffa3da9..e967b2a8 100644 --- a/common/options.c +++ b/common/options.c @@ -34,7 +34,7 @@ #ifndef lint static char copyright[] = -"$Id: options.c,v 1.98.2.17 2008/07/19 03:56:45 each Exp $ Copyright (c) 2004-2008 Internet Systems Consortium. All rights reserved.\n"; +"$Id: options.c,v 1.98.2.18 2008/12/02 19:49:09 sar Exp $ Copyright (c) 2004-2008 Internet Systems Consortium. All rights reserved.\n"; #endif /* not lint */ #define DHCP_OPTION_DATA @@ -1562,17 +1562,31 @@ const char *pretty_print_option (option, data, len, emit_commas, emit_quotes) pretty_domain(&op, endbuf-1, &nbp, nend); } else { + /* ns_name_ntop() includes + * a trailing NUL in its + * count. + */ count = MRns_name_ntop( nbuff, op, (endbuf-op)-1); - if (count == -1) { + if (count <= 0) { log_error("Invalid " "domain name."); break; } - op += count; + /* Consume all but the trailing + * NUL. + */ + op += count - 1; + + /* Replace the trailing NUL + * with the implicit root + * (in the unlikely event the + * domain name /is/ the root). + */ + *op++ = '.'; } } *op = '\0'; |