cangen: set unused payload to zero

This commit is contained in:
Oliver Hartkopp
2012-01-28 17:30:33 +01:00
parent 722a09116d
commit 8197afe2c1
+4
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]);