mirror of
https://github.com/linux-can/can-utils.git
synced 2026-08-04 22:09:57 +02:00
canplayer: ensure 6 decimal places in timestamp for first frame
The check has only been applied after the first CAN frame has been read
and evaluated. This lead to an unintended sending of a single handcrafted
frame with a following (intended) failure at the second frame.
Apply the check also for the very first CAN frame that is processed.
Fixes: ee0233505b ("canplayer: ensure 6 decimal places in timestamp")
Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
This commit is contained in:
@@ -425,6 +425,15 @@ int main(int argc, char **argv)
|
||||
return 1;
|
||||
}
|
||||
|
||||
/*
|
||||
* ensure the fractions of seconds are 6 decimal places long to catch
|
||||
* 3rd party or handcrafted logfiles that treat the timestamp as float
|
||||
*/
|
||||
if (strchr(buf, ')') - strchr(buf, '.') != 7) {
|
||||
fprintf(stderr, "timestamp format in logfile requires 6 decimal places\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (use_timestamps) { /* throttle sending due to logfile timestamps */
|
||||
|
||||
gettimeofday(&today_tv, NULL);
|
||||
|
||||
Reference in New Issue
Block a user