We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see ourdocumentation.
There was an error while loading.Please reload this page.
2 parentsf1ae7d0 +fc4a570 commit65633ceCopy full SHA for 65633ce
api/CanMsg.h
@@ -45,7 +45,8 @@ class CanMsg : public Printable
45
, data_length{min(can_data_len, MAX_DATA_LENGTH)}
46
, data{0}
47
{
48
-memcpy(data, can_data_ptr, data_length);
+if (data_length && can_data_ptr)
49
+memcpy(data, can_data_ptr, data_length);
50
}
51
52
CanMsg() : CanMsg(0,0,nullptr) { }
@@ -54,7 +55,8 @@ class CanMsg : public Printable
54
55
56
this->id = other.id;
57
this->data_length = other.data_length;
-memcpy(this->data, other.data,this->data_length);
58
+if (this->data_length && other.data)
59
+memcpy(this->data, other.data,this->data_length);
60
61
62
virtual~CanMsg() { }
@@ -65,7 +67,8 @@ class CanMsg : public Printable
65
67
66
68
69
70
71
72
73
return (*this);
74