diff --git a/src/iocsh/iocsh.cpp b/src/iocsh/iocsh.cpp index afb8ed5d7..e6601aacb 100644 --- a/src/iocsh/iocsh.cpp +++ b/src/iocsh/iocsh.cpp @@ -239,7 +239,16 @@ cvtArg (const char *filename, int lineno, char *arg, iocshArgBuf *argBuf, const switch (piocshArg->type) { case iocshArgInt: if (arg && *arg) { + errno = 0; argBuf->ival = strtol (arg, &endp, 0); + if (errno == ERANGE) { + errno = 0; + argBuf->ival = strtoul (arg, &endp, 0); + if (errno == ERANGE) { + showError (filename, lineno, "Integer `%s' out of range", arg); + return 0; + } + } if (*endp) { showError (filename, lineno, "Illegal integer `%s'", arg); return 0;