From 4e3d8370476eee8537d8dc325d588fca43928098 Mon Sep 17 00:00:00 2001 From: Andre Noll Date: Sun, 30 Aug 2009 14:26:32 +0200 Subject: [PATCH] com_stat(): Be more anal in checking command line options. Also check the number of arguments and use para_atoi32 to convert the argument into an int. --- command.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/command.c b/command.c index e3b15a5a..f61ea572 100644 --- a/command.c +++ b/command.c @@ -307,8 +307,13 @@ int com_stat(int fd, int argc, char * const * argv) para_sigaction(SIGUSR1, dummy); - if (argc > 1) - num = atoi(argv[1]); + if (argc > 2) + return -E_COMMAND_SYNTAX; + if (argc > 1) { + ret = para_atoi32(argv[1], &num); + if (ret < 0) + goto out; + } for (;;) { mmd_dup(nmmd); -- 2.39.2