Allow CoE OD List Segments to have 6 bytes instead of 8.
authorFlorian Pose <fp@igh-essen.com>
Thu, 05 Jan 2012 16:47:23 +0100
changeset 2194 1b583b3110cb
parent 2190 3fe304fea395
child 2195 d9146c0ff00f
Allow CoE OD List Segments to have 6 bytes instead of 8.
master/fsm_coe.c
--- a/master/fsm_coe.c	Wed Jan 04 18:05:38 2012 +0100
+++ b/master/fsm_coe.c	Thu Jan 05 16:47:23 2012 +0100
@@ -507,16 +507,16 @@
         return;
     }
 
-    if (rec_size < 8 || rec_size % 2) {
-        EC_SLAVE_ERR(slave, "Invalid data size %zu!\n", rec_size);
-        ec_print_data(data, rec_size);
-        fsm->state = ec_fsm_coe_error;
-        return;
-    }
-
     first_segment = list_empty(&slave->sdo_dictionary) ? true : false;
     index_list_offset = first_segment ? 8 : 6;
 
+    if (rec_size < index_list_offset || rec_size % 2) {
+        EC_SLAVE_ERR(slave, "Invalid data size %zu !\n", rec_size);
+        ec_print_data(data, rec_size);
+        fsm->state = ec_fsm_coe_error;
+        return;
+    }
+
     sdo_count = (rec_size - index_list_offset) / 2;
 
     for (i = 0; i < sdo_count; i++) {