2
0
mirror of https://gitlab.isc.org/isc-projects/dhcp synced 2025-09-02 07:15:44 +00:00

Correctly quote shell meta-characters.

This commit is contained in:
Ted Lemon
2000-06-28 23:35:22 +00:00
parent f3a05d7262
commit 4de4bfcd2c

View File

@@ -43,7 +43,7 @@
#ifndef lint #ifndef lint
static char copyright[] = static char copyright[] =
"$Id: options.c,v 1.61 2000/06/24 06:20:38 mellon Exp $ Copyright (c) 1995-2000 The Internet Software Consortium. All rights reserved.\n"; "$Id: options.c,v 1.62 2000/06/28 23:35:22 mellon Exp $ Copyright (c) 1995-2000 The Internet Software Consortium. All rights reserved.\n";
#endif /* not lint */ #endif /* not lint */
#define DHCP_OPTION_DATA #define DHCP_OPTION_DATA
@@ -672,21 +672,21 @@ const char *pretty_print_option (code, data, len, emit_commas, emit_quotes)
case 't': case 't':
if (emit_quotes) if (emit_quotes)
*op++ = '"'; *op++ = '"';
for (k = 0; dp [k]; k++) { for (; dp < data + len; dp++) {
if (!isascii (dp [k]) || if (!isascii (*dp) ||
!isprint (dp [k])) { !isprint (*dp)) {
sprintf (op, "\\%03o", sprintf (op, "\\%03o",
dp [k]); *dp);
op += 4; op += 4;
} else if (dp [k] == '"' || } else if (*dp == '"' ||
dp [k] == '\'' || *dp == '\'' ||
dp [k] == '$' || *dp == '$' ||
dp [k] == '`' || *dp == '`' ||
dp [k] == '\\') { *dp == '\\') {
*op++ = '\\'; *op++ = '\\';
*op++ = dp [k]; *op++ = *dp;
} else } else
*op++ = dp [k]; *op++ = *dp;
} }
if (emit_quotes) if (emit_quotes)
*op++ = '"'; *op++ = '"';