escape non-printable chars in dbgf output of CHAR arrays

This commit is contained in:
2022-07-28 11:11:06 +02:00
committed by Michael Davidsaver
parent 20e20cbf2b
commit dc70dfd625

View File

@@ -996,8 +996,12 @@ static void printBuffer(
i = 0;
while (len > 0) {
int chunk = (len > MAXLINE - 5) ? MAXLINE - 5 : len;
sprintf(pmsg, "\"%.*s\"", chunk, (char *)pbuffer + i);
strcpy(pmsg, "\"");
while (epicsStrnEscapedFromRawSize((char *)pbuffer + i, chunk) >= MAXLINE - 5)
chunk--;
epicsStrnEscapedFromRaw(pmsg+1, MAXLINE - 5,
(char *)pbuffer + i, chunk);
strcat(pmsg, "\"");
len -= chunk; i += chunk;
if (len > 0)
strcat(pmsg, " +");