This is an automated email from Gerrit. Christopher Head ([email protected]) just uploaded a new patch set to Gerrit, which you can find at http://openocd.zylin.com/5298
-- gerrit commit 2bf4dda995e37105c1b92f8926c4500b664bb97b Author: Christopher Head <[email protected]> Date: Mon Sep 9 13:52:51 2019 -0700 helper/command: clear errno before calling parser The C standard says that errno is set to ERANGE if an out-of-range value is returned by strtol, strtoul, et. al., but it does not say that errno is cleared if the function is successful (and, indeed, it is not on glibc). This means that, if errno is ERANGE before strtol is called, and if the value to be converted is exactly the maximum (or, for a signed conversion, the minimum) legal value, COMMAND_PARSE_NUMBER will erroneously indicate that the value is out of range. Change-Id: I8a8b50a815b408a38235968f1c1d70297ea1a6aa Signed-off-by: Christopher Head <[email protected]> diff --git a/src/helper/command.c b/src/helper/command.c index 7b93df6..d969933 100644 --- a/src/helper/command.c +++ b/src/helper/command.c @@ -1394,6 +1394,7 @@ void process_jim_events(struct command_context *cmd_ctx) return ERROR_COMMAND_ARGUMENT_INVALID; \ } \ char *end; \ + errno = 0; \ *ul = func(str, &end, 0); \ if (*end) { \ LOG_ERROR("Invalid command argument"); \ -- _______________________________________________ OpenOCD-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/openocd-devel
