AP_Proximity: use strtol instead of sscanf

This commit is contained in:
Andrew Tridgell 2019-08-01 15:08:14 +10:00
parent 9d760a2956
commit a4258639c8
1 changed files with 2 additions and 2 deletions

View File

@ -383,8 +383,8 @@ bool AP_Proximity_LightWareSF40C::process_reply()
case RequestType_Health:
// expect result in the form "0xhhhh"
if (element_len[0] > 0) {
int result;
if (sscanf(element_buf[0], "%x", &result) > 0) {
long int result = strtol(element_buf[0], nullptr, 16);
if (result > 0) {
_sensor_status.value = result;
success = true;
}