2020-02-10 08:14:44

by Markus Theil

[permalink] [raw]
Subject: [PATCH 1/2] iw: scan: fix if scope for print_measurement_pilot_tx()

Signed-off-by: Markus Theil <[email protected]>
---
scan.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/scan.c b/scan.c
index 8f8d8ba..7155cdf 100644
--- a/scan.c
+++ b/scan.c
@@ -1561,9 +1561,10 @@ static void print_measurement_pilot_tx(const uint8_t type, uint8_t len,
p[0], p[1], p[2]);
len_remaining -= 3;

- if (len > len_remaining)
+ if (len > len_remaining) {
printf(" <Parse error, element too short>\n");
return;
+ }

while (p < p + len)
printf(" %.2x", *p);
--
2.25.0


2020-02-10 08:14:44

by Markus Theil

[permalink] [raw]
Subject: [PATCH 2/2] iw: scan: fix some format string warnings found by clang

Signed-off-by: Markus Theil <[email protected]>
---
scan.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/scan.c b/scan.c
index 7155cdf..98c5c10 100644
--- a/scan.c
+++ b/scan.c
@@ -1131,10 +1131,10 @@ static void print_interworking(const uint8_t type, uint8_t len,
printf("\t\tVenue Type: %i\n", (int)(data[2]));
}
if (len == 9)
- printf("\t\tHESSID: %02hx:%02hx:%02hx:%02hx:%02hx:%02hx\n",
+ printf("\t\tHESSID: %02hhx:%02hhx:%02hhx:%02hhx:%02hhx:%02hhx\n",
data[3], data[4], data[5], data[6], data[7], data[8]);
else if (len == 7)
- printf("\t\tHESSID: %02hx:%02hx:%02hx:%02hx:%02hx:%02hx\n",
+ printf("\t\tHESSID: %02hhx:%02hhx:%02hhx:%02hhx:%02hhx:%02hhx\n",
data[1], data[2], data[3], data[4], data[5], data[6]);
}

@@ -1193,7 +1193,7 @@ static void print_11u_rcon(const uint8_t type, uint8_t len, const uint8_t *data,
printf("Invalid IE length.\n");
} else {
for (idx = 0; idx < ln0; idx++) {
- printf("%02hx", data[2 + idx]);
+ printf("%02hhx", data[2 + idx]);
}
printf("\n");
}
@@ -1205,7 +1205,7 @@ static void print_11u_rcon(const uint8_t type, uint8_t len, const uint8_t *data,
printf("Invalid IE length.\n");
} else {
for (idx = 0; idx < ln1; idx++) {
- printf("%02hx", data[2 + ln0 + idx]);
+ printf("%02hhx", data[2 + ln0 + idx]);
}
printf("\n");
}
@@ -1217,7 +1217,7 @@ static void print_11u_rcon(const uint8_t type, uint8_t len, const uint8_t *data,
printf("Invalid IE length.\n");
} else {
for (idx = 0; idx < ln2; idx++) {
- printf("%02hx", data[2 + ln0 + ln1 + idx]);
+ printf("%02hhx", data[2 + ln0 + ln1 + idx]);
}
printf("\n");
}
--
2.25.0