aboutsummaryrefslogtreecommitdiff
path: root/bsd-user/main.c
diff options
context:
space:
mode:
authorWarner Losh <imp@bsdimp.com>2021-04-23 11:00:34 -0600
committerWarner Losh <imp@bsdimp.com>2021-05-11 11:07:21 -0600
commit29aabb4fc3b354e8f3bbaa1b542e27d54c324271 (patch)
tree863b30c2c423ff697efdf97801cdcd5d20b481d4 /bsd-user/main.c
parentb23a51dc911da0a0e884b838d26aa1017ca2dd63 (diff)
bsd-user: use qemu_strtoul in preference to strtol
Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Signed-off-by: Warner Losh <imp@bsdimp.com>
Diffstat (limited to 'bsd-user/main.c')
-rw-r--r--bsd-user/main.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/bsd-user/main.c b/bsd-user/main.c
index 0f9e6bfbc0..18f806b032 100644
--- a/bsd-user/main.c
+++ b/bsd-user/main.c
@@ -36,6 +36,7 @@
#include "tcg/tcg.h"
#include "qemu/timer.h"
#include "qemu/envlist.h"
+#include "qemu/cutils.h"
#include "exec/log.h"
#include "trace/control.h"
@@ -612,7 +613,7 @@ int main(int argc, char **argv)
TaskState ts1, *ts = &ts1;
CPUArchState *env;
CPUState *cpu;
- int optind;
+ int optind, rv;
const char *r;
const char *gdbstub = NULL;
char **target_environ, **wrk;
@@ -677,8 +678,8 @@ int main(int argc, char **argv)
}
} else if (!strcmp(r, "s")) {
r = argv[optind++];
- x86_stack_size = strtol(r, (char **)&r, 0);
- if (x86_stack_size <= 0) {
+ rv = qemu_strtoul(r, &r, 0, &x86_stack_size);
+ if (rv < 0 || x86_stack_size <= 0) {
usage();
}
if (*r == 'M') {
@@ -709,7 +710,10 @@ int main(int argc, char **argv)
exit(1);
}
} else if (!strcmp(r, "B")) {
- guest_base = strtol(argv[optind++], NULL, 0);
+ rv = qemu_strtoul(argv[optind++], NULL, 0, &guest_base);
+ if (rv < 0) {
+ usage();
+ }
have_guest_base = true;
} else if (!strcmp(r, "drop-ld-preload")) {
(void) envlist_unsetenv(envlist, "LD_PRELOAD");