diff options
| author | Daniel Golle | 2021-11-22 01:19:05 +0000 |
|---|---|---|
| committer | Daniel Golle | 2021-11-22 01:23:33 +0000 |
| commit | b2c53dc67a6a509f6e6d7f6ba540c55bbc34e988 (patch) | |
| tree | 51bf394349e952f7688b65ef93ae32303cfbe6dd | |
| parent | 20cd9075df2dffd4db0aa05addec31733af4f6cb (diff) | |
| download | uqmi-b2c53dc67a6a509f6e6d7f6ba540c55bbc34e988.tar.gz | |
command-nas: fix out-of-bounds read
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>
| -rw-r--r-- | commands-nas.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/commands-nas.c b/commands-nas.c index 123ba63..01ca3b8 100644 --- a/commands-nas.c +++ b/commands-nas.c @@ -83,7 +83,7 @@ print_earfcn_info(uint32_t earfcn) { 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); |