cangen: set unused payload to zero

pull/7/head
Oliver Hartkopp 2012-01-28 17:30:33 +01:00
parent 722a09116d
commit 8197afe2c1
1 changed files with 4 additions and 0 deletions

View File

@ -350,6 +350,10 @@ int main(int argc, char **argv)
*(unsigned long*)(&frame.data[4]) = random(); *(unsigned long*)(&frame.data[4]) = random();
} }
/* set unused payload data to zero like the CAN driver does it on rx */
if (frame.can_dlc < 8)
memset(&frame.data[frame.can_dlc], 0, 8 - frame.can_dlc);
if (verbose) { if (verbose) {
printf(" %s ", argv[optind]); printf(" %s ", argv[optind]);