uORB: fix node_open: *instance is read even though it's an output parameter
This fixes a subtle bug: the instance parameter of orb_advertise is an output parameter and thus its value can be random. However in node_open this value is accessed and thus the open(...) call could succeed even though it should not. This can happen for example if a second advertiser of a topic calls orb_advertise_multi with *instance=0. The existing implementation worked only because *instance was initialized with -1 in most cases.
Showing
- src/modules/uORB/uORBMain.cpp 4 additions, 0 deletionssrc/modules/uORB/uORBMain.cpp
- src/modules/uORB/uORBManager_nuttx.cpp 15 additions, 19 deletionssrc/modules/uORB/uORBManager_nuttx.cpp
- src/modules/uORB/uORBManager_posix.cpp 15 additions, 23 deletionssrc/modules/uORB/uORBManager_posix.cpp
- src/modules/uORB/uORBTest_UnitTest.cpp 1 addition, 1 deletionsrc/modules/uORB/uORBTest_UnitTest.cpp
Loading
Please register or sign in to comment