[etherlab-users] Bug in function ecrt_master_get_slave
Olaf Holowenko
holowenko at iwm.mw.tu-dresden.de
Wed Mar 13 13:10:09 CET 2013
Hi all,
in file /master/master.c, function ecrt_master_get_slave you can find the
code
>> slave = ec_master_find_slave_const(master, 0, slave_position);
>>
>> slave_info->position = slave->ring_position;
(V1.5.1 about line 2300, V1.5.2 line 2632) If you follow
ec_master_find_slave_const you will see: this function may return NULL in
case slave_position is not valid / used, the next line will cause a
segmentation fault.
ectr.h tells us, that only the pointers have to be valid variables. I
suggest to add the following lines (V1.5.1):
>> slave = ec_master_find_slave_const(master, 0, slave_position);
>> if(slave==NULL)
>> {
>> up(&master->master_sem);
>> return -666; // or whatever errorcode.
>> }
>>
>> slave_info->position = slave->ring_position;
Olaf
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.etherlab.org/pipermail/etherlab-users/attachments/20130313/a592bfc0/attachment-0002.htm>
More information about the Etherlab-users
mailing list