forked from osmocom/wireshark
androiddump: Fix warning about unneeded value
Value from strtol is not needed in this case, but compiler complains about it, so check if value range is valid and other possible error that can be detected. Change-Id: I6a8eeb6d2cb62c155772201000eca4c16bc8a555 Reviewed-on: https://code.wireshark.org/review/8172 Reviewed-by: Alexis La Goutte <alexis.lagoutte@gmail.com> Petri-Dish: Alexis La Goutte <alexis.lagoutte@gmail.com> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Michal Labedzki <michal.labedzki@tieto.com>
This commit is contained in:
parent
4ea4ddbe6a
commit
0e572cbcbf
|
@ -1140,10 +1140,18 @@ static int capture_android_bluetooth_hcidump(char *interface, char *fifo,
|
|||
|
||||
if (hex == 0x01) {
|
||||
hex_data = new_hex_data;
|
||||
strtol(hex_data, &new_hex_data, 16);
|
||||
hex = strtol(hex_data, &new_hex_data, 16);
|
||||
if (hex < 0 || hex >= 256 || hex_data == new_hex_data) {
|
||||
printf("ERROR: data format error: %s\n", strerror(errno));
|
||||
return 101;
|
||||
}
|
||||
|
||||
hex_data = new_hex_data;
|
||||
strtol(hex_data, &new_hex_data, 16);
|
||||
hex = strtol(hex_data, &new_hex_data, 16);
|
||||
if (hex < 0 || hex >= 256 || hex_data == new_hex_data) {
|
||||
printf("ERROR: data format error: %s\n", strerror(errno));
|
||||
return 101;
|
||||
}
|
||||
|
||||
hex_data = new_hex_data;
|
||||
hex = strtol(hex_data, &new_hex_data, 16);
|
||||
|
@ -1151,18 +1159,30 @@ static int capture_android_bluetooth_hcidump(char *interface, char *fifo,
|
|||
raw_length = hex + 4;
|
||||
} else if (hex == 0x04) {
|
||||
hex_data = new_hex_data;
|
||||
strtol(hex_data, &new_hex_data, 16);
|
||||
hex = strtol(hex_data, &new_hex_data, 16);
|
||||
if (hex < 0 || hex >= 256 || hex_data == new_hex_data) {
|
||||
printf("ERROR: data format error: %s\n", strerror(errno));
|
||||
return 101;
|
||||
}
|
||||
|
||||
hex_data = new_hex_data;
|
||||
hex = strtol(hex_data, &new_hex_data, 16);
|
||||
|
||||
raw_length = hex +3;
|
||||
raw_length = hex + 3;
|
||||
} else if (hex == 0x02) {
|
||||
hex_data = new_hex_data;
|
||||
strtol(hex_data, &new_hex_data, 16);
|
||||
hex = strtol(hex_data, &new_hex_data, 16);
|
||||
if (hex < 0 || hex >= 256 || hex_data == new_hex_data) {
|
||||
printf("ERROR: data format error: %s\n", strerror(errno));
|
||||
return 101;
|
||||
}
|
||||
|
||||
hex_data = new_hex_data;
|
||||
strtol(hex_data, &new_hex_data, 16);
|
||||
hex = strtol(hex_data, &new_hex_data, 16);
|
||||
if (hex < 0 || hex >= 256 || hex_data == new_hex_data) {
|
||||
printf("ERROR: data format error: %s\n", strerror(errno));
|
||||
return 101;
|
||||
}
|
||||
|
||||
hex_data = new_hex_data;
|
||||
hex = strtol(hex_data, &new_hex_data, 16);
|
||||
|
|
Loading…
Reference in New Issue