asc2log: make sure we have read the dlc value with sscanf()

Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
pull/365/head
Oliver Hartkopp 2022-05-01 13:02:08 +02:00
parent afc6a324da
commit 2bdb93924e
1 changed files with 6 additions and 0 deletions

View File

@ -170,6 +170,9 @@ void eval_can(char* buf, struct timeval *date_tvp, char timestamps, char base, i
&data[0], &data[1], &data[2], &data[3],
&data[4], &data[5], &data[6], &data[7]);
if (items < 7 ) /* make sure we've read the dlc */
return;
if ((items == dlc + 7 ) || /* data frame */
((items == 6) && (rtr == 'r')) || /* RTR without DLC */
((items == 7) && (rtr == 'r'))) { /* RTR with DLC */
@ -185,6 +188,9 @@ void eval_can(char* buf, struct timeval *date_tvp, char timestamps, char base, i
&data[0], &data[1], &data[2], &data[3],
&data[4], &data[5], &data[6], &data[7]);
if (items < 7 ) /* make sure we've read the dlc */
return;
if ((items == dlc + 7 ) || /* data frame */
((items == 6) && (rtr == 'r')) || /* RTR without DLC */
((items == 7) && (rtr == 'r'))) { /* RTR with DLC */