diff options
author | 2005-07-15 10:40:27 +0000 | |
---|---|---|
committer | 2005-07-15 10:40:27 +0000 | |
commit | a0029f827bcfab1dc926c79332b7a1101921ada9 (patch) | |
tree | f2c14ca71c72109fd3629f749eee271c95628bda | |
parent | some improvements from ray lai: mainly dealing with erroneous double (diff) | |
download | wireguard-openbsd-a0029f827bcfab1dc926c79332b7a1101921ada9.tar.xz wireguard-openbsd-a0029f827bcfab1dc926c79332b7a1101921ada9.zip |
let pretty_print_option() handle trailing nul bytes correctly (i. e. don't
let a trailing nul byte force hex printing)
FreeBSD PR 83468 by Sean Winn <sean@gothic.net.au>, via jmc@
-rw-r--r-- | sbin/dhclient/options.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/sbin/dhclient/options.c b/sbin/dhclient/options.c index 42fa492d75a..18e77264e8b 100644 --- a/sbin/dhclient/options.c +++ b/sbin/dhclient/options.c @@ -1,4 +1,4 @@ -/* $OpenBSD: options.c,v 1.22 2005/07/13 23:33:04 deraadt Exp $ */ +/* $OpenBSD: options.c,v 1.23 2005/07/15 10:40:27 henning Exp $ */ /* DHCP options parsing and reassembly. */ @@ -279,7 +279,11 @@ pretty_print_option(unsigned int code, unsigned char *data, int len, if (!isascii(data[k]) || !isprint(data[k])) break; - if (k == len) { + /* If we found no bogus characters, or the bogus + character we found is a trailing NUL, it's + okay to print this option as text. */ + + if (k == len || (k + 1 == len && data [k] == 0)) { fmtbuf[i] = 't'; numhunk = -2; } else { |