candump: add sprintf error handling in sprint_timestamp

Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
pull/504/head
Oliver Hartkopp 2024-02-27 11:33:01 +01:00
parent f491175d72
commit 57238d5f81
1 changed files with 5 additions and 0 deletions

View File

@ -270,6 +270,11 @@ static int sprint_timestamp(char *ts_buffer, const char timestamp,
break;
}
if (numchars <= 0) {
ts_buffer[0] = 0; /* empty terminated string */
numchars = 0;
}
return numchars;
}