diff mbox

DEL char (ASCII 127 decimal) now escaped

Message ID 1444684715-6418-1-git-send-email-krellan@krellan.net
State Accepted
Headers show

Commit Message

Josh Lehan Oct. 12, 2015, 9:18 p.m. UTC
Hello!

While testing, I noticed that printf_encode() makes
control characters human-readable, with one exemption,
the DEL character (ASCII 127).

Assuming this exemption was unintentional, here is a trivial patch
to make it appear as an escaped \x7f instead of a literal
DEL character in the output.

I am trying to allow the choice of wireless network name and password
to be as binary-clean as possible, and this will help.

Thank you!

Josh Lehan

Signed-off-by: Josh Lehan <krellan@krellan.net>
---
 src/utils/common.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox

Patch

diff --git a/src/utils/common.c b/src/utils/common.c
index 660e9fc..e74a2ae 100644
--- a/src/utils/common.c
+++ b/src/utils/common.c
@@ -498,7 +498,7 @@  void printf_encode(char *txt, size_t maxlen, const u8 *data, size_t len)
 			*txt++ = 't';
 			break;
 		default:
-			if (data[i] >= 32 && data[i] <= 127) {
+			if (data[i] >= 32 && data[i] <= 126) {
 				*txt++ = data[i];
 			} else {
 				txt += os_snprintf(txt, end - txt, "\\x%02x",