diff options
author | Bob Beck <beck@cvs.openbsd.org> | 2001-07-04 17:06:29 +0000 |
---|---|---|
committer | Bob Beck <beck@cvs.openbsd.org> | 2001-07-04 17:06:29 +0000 |
commit | 56fd4f374bd7cb084a2393ebdbdc535e9a085a44 (patch) | |
tree | dddb99a9e6427614b6701cc22aadbb0449136d8f | |
parent | 9263af4975033fd9907b459099ba61351c1e4ee1 (diff) |
check for nul bytes on the end of an option buffer, since windows 2000
erroneously puts them into hostname and the like returned by a dhcp server.
-rw-r--r-- | usr.sbin/dhcp/common/options.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/usr.sbin/dhcp/common/options.c b/usr.sbin/dhcp/common/options.c index b88e6fcc0a7..e27456aa303 100644 --- a/usr.sbin/dhcp/common/options.c +++ b/usr.sbin/dhcp/common/options.c @@ -579,11 +579,13 @@ char *pretty_print_option (code, data, len, emit_commas, emit_quotes) for (; dp < data + len; dp++) { if (!isascii (*dp) || !isprint (*dp)) { - snprintf (op, opleft, "\\%03o", - *dp); - op += 4; - opleft -= 4; - + if (dp + 1 != data + len || + *dp != 0) { + snprintf(op, opleft, + "\\%03o", *dp); + op += 4; + opleft -= 4; + } } else if (*dp == '"' || *dp == '\'' || *dp == '$' || |