From bed17f3be8b26f6d9d682936ba82e94331161f4d Mon Sep 17 00:00:00 2001 From: Haakan T Johansson Date: Sat, 29 Jul 2023 09:43:32 +0200 Subject: [PATCH] Parse USB bus:dev as decimal integers, to be consistent with --scan-usb. Do not accept auto-detected base 0 (e.g. prefix '0x' for hex), since '0' prefix gives an octal interpretation, and the user is likely to copy values from `--scan-usb` or `lsusb` that could then be misinterpreted, e.g. 005:010. --- src/main.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index d090c19b5e..b2e29dbd78 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -895,9 +895,9 @@ int parse_opt(int argc, char **argv, struct arguments *args, } try { args->bus_addr = static_cast(std::stoi(bus_dev_num[0], - nullptr, 16)); + nullptr, 10)); args->device_addr = static_cast( - std::stoi(bus_dev_num[1], nullptr, 16)); + std::stoi(bus_dev_num[1], nullptr, 10)); } catch (std::exception &e) { printError("Error: busdev-num invalid format: must be numeric values"); throw std::exception();