diff options
Diffstat (limited to 'contrib/isc-dhcp/common/options.c')
-rw-r--r-- | contrib/isc-dhcp/common/options.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/contrib/isc-dhcp/common/options.c b/contrib/isc-dhcp/common/options.c index b80ffa1..b840716 100644 --- a/contrib/isc-dhcp/common/options.c +++ b/contrib/isc-dhcp/common/options.c @@ -553,9 +553,13 @@ char *pretty_print_option (code, data, len, emit_commas, emit_quotes) for (; dp < data + len; dp++) { if (!isascii (*dp) || !isprint (*dp)) { - sprintf (op, "\\%03o", - *dp); - op += 4; + /* Skip trailing NUL. */ + if (dp + 1 != data + len || + *dp != 0) { + sprintf (op, "\\%03o", + *dp); + op += 4; + } } else if (*dp == '"' || *dp == '\'' || *dp == '$' || |