Decawave / dwm1001-examples

Simple C examples for Decawave DWM1001 hardware
https://www.decawave.com/products/dwm1001-module
163 stars 112 forks source link

Array bound check error #10

Closed azizbahri closed 6 years ago

azizbahri commented 6 years ago

Pretty sure the bound check here is reversed.

int dwt_setlocaldataptr(unsigned int index) { // Check the index is within the array bounds if (DWT_NUM_DW_DEV > index) // return error if index outside the array bounds { return DWT_ERROR ; }

pdw1000local = &dw1000local[index];

return DWT_SUCCESS ;

}

YBDecawave commented 6 years ago

Hi Aziz,

What do you exactly mean ?

I guess index < DWT_NUM_DW_DEV would be better for readability but the overall behavior is identical.

Thank you, Regards Yves

azizbahri commented 6 years ago

you are returning DWT_ERROR if (index < DWT_NUM_DW_DEV) is true .

YBDecawave commented 6 years ago

Hi Aziz,

You are right.

This will be fixed in our next DW1000 api firmware release.

Thank you, Yves