Limit iteration to number of array members fixing potential
out-of-bounds read.
Coverity CID:
1493471 Out-of-bounds read
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
{ 45590, 46589, 44, 700, "TDD" },
};
- for (int i = 0; i < sizeof(earfcn_ranges); i++) {
+ for (int i = 0; i < (sizeof(earfcn_ranges) / sizeof(*earfcn_ranges)); i++) {
if (earfcn <= earfcn_ranges[i].max && earfcn >= earfcn_ranges[i].min) {
blobmsg_add_u32(&status, "band", earfcn_ranges[i].band);
blobmsg_add_u32(&status, "frequency", earfcn_ranges[i].freq);