From edf7adf21e1c210e5954b1128efb61b62f6da274 Mon Sep 17 00:00:00 2001 From: JP Abgrall Date: Wed, 12 Mar 2014 10:41:05 -0700 Subject: [PATCH] Avoid segv by checking argc in "storage user " Change-Id: Iffd67746e2e273c4c3f87741e5f13aa511ccb557 Signed-off-by: JP Abgrall --- CommandListener.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CommandListener.cpp b/CommandListener.cpp index ea18c1d..c8d6848 100644 --- a/CommandListener.cpp +++ b/CommandListener.cpp @@ -242,6 +242,10 @@ int CommandListener::StorageCmd::runCommand(SocketClient *cli, DIR *dir; struct dirent *de; + if (argc < 3) { + cli->sendMsg(ResponseCode::CommandSyntaxError, "Missing Argument: user ", false); + return 0; + } if (!(dir = opendir("/proc"))) { cli->sendMsg(ResponseCode::OperationFailed, "Failed to open /proc", true); return 0;