at: escape non text characters in modem response logs

This commit is contained in:
ArenM
2021-10-03 19:58:25 -04:00
parent 89b7dfda2f
commit aec8135ad4

View File

@@ -241,12 +241,15 @@ static gboolean modem_response(gint fd,
} while (ret > 0 && pos < (sizeof(response) - 1)); } while (ret > 0 && pos < (sizeof(response) - 1));
if (pos > 0) { if (pos > 0) {
g_autofree gchar *escaped = NULL;
response[pos] = 0; response[pos] = 0;
g_strstrip(response); g_strstrip(response);
if (strlen(response) == 0) if (strlen(response) == 0)
return TRUE; 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 * When the modem is started, it outputs 'RDY' to indicate that