dbgf: Don't print beyond last buffer char
This commit is contained in:
@@ -950,7 +950,9 @@ static void printBuffer(
|
||||
}
|
||||
else {
|
||||
for (i = 0; i < no_elements; i+= MAXLINE - 5) {
|
||||
sprintf(pmsg, " \"%.*s\"", MAXLINE - 5, (char *)pbuffer + i);
|
||||
int width = no_elements - i;
|
||||
if (width > MAXLINE - 5) width = MAXLINE - 5;
|
||||
sprintf(pmsg, " \"%.*s\"", width, (char *)pbuffer + i);
|
||||
if (i + MAXLINE - 5 < no_elements) strcat(pmsg, " +");
|
||||
dbpr_msgOut(pMsgBuff, tab_size);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user