diff options
author | Kenneth R Westerback <krw@cvs.openbsd.org> | 2017-03-26 21:33:37 +0000 |
---|---|---|
committer | Kenneth R Westerback <krw@cvs.openbsd.org> | 2017-03-26 21:33:37 +0000 |
commit | 55c7bc3f96f831eed9a6ec7a6a1c82ea969f5821 (patch) | |
tree | 34eec087d01c288d32870f79e7e5669f34d3c634 /sbin | |
parent | 3911de570775039ed3a201c3d4b5a4b097ddf956 (diff) |
Fix dhclient vis/unvis of strings stored in the leases file.
Replaces incorrect manual emulation of vis() for single, double and
back quotes, dollar signs and back slashes. Just use vis() with
VIS_ALL for these characters.
Should fix problem reported by robert@ with ssid's containing back
slash.
Diffstat (limited to 'sbin')
-rw-r--r-- | sbin/dhclient/options.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/sbin/dhclient/options.c b/sbin/dhclient/options.c index 8c80242664d..a339681e541 100644 --- a/sbin/dhclient/options.c +++ b/sbin/dhclient/options.c @@ -1,4 +1,4 @@ -/* $OpenBSD: options.c,v 1.82 2017/03/08 14:19:00 krw Exp $ */ +/* $OpenBSD: options.c,v 1.83 2017/03/26 21:33:36 krw Exp $ */ /* DHCP options parsing and reassembly. */ @@ -236,11 +236,10 @@ pretty_print_string(unsigned char *dst, size_t dstlen, unsigned char *src, for (; src < origsrc + srclen; src++) { if (*src && strchr("\"'$`\\", *src)) - opcount = snprintf(dst, dstlen, "\\%c", *src); - else { + vis(visbuf, *src, VIS_ALL | VIS_OCTAL, *src+1); + else vis(visbuf, *src, VIS_OCTAL, *src+1); - opcount = snprintf(dst, dstlen, "%s", visbuf); - } + opcount = snprintf(dst, dstlen, "%s", visbuf); if (opcount == -1) return (-1); total += opcount; |