From aec8135ad4c30c56e2afdf2426d9a6bbb806a5b1 Mon Sep 17 00:00:00 2001 From: ArenM Date: Sun, 3 Oct 2021 19:58:25 -0400 Subject: [PATCH] at: escape non text characters in modem response logs --- src/at.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/at.c b/src/at.c index a252923..b8bb3e8 100644 --- a/src/at.c +++ b/src/at.c @@ -241,12 +241,15 @@ static gboolean modem_response(gint fd, } while (ret > 0 && pos < (sizeof(response) - 1)); if (pos > 0) { + g_autofree gchar *escaped = NULL; + response[pos] = 0; g_strstrip(response); if (strlen(response) == 0) return TRUE; - g_message("Response: [%s]", response); + escaped = g_strescape(response, "\""); + g_message("Response: [%s]", escaped); /* * When the modem is started, it outputs 'RDY' to indicate that