From 02eaad6a8971891a6e1279f06874d00efd472489 Mon Sep 17 00:00:00 2001 From: YuQing <384681@qq.com> Date: Thu, 20 May 2021 16:49:53 +0800 Subject: [PATCH] check required argument --- src/sf_util.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/sf_util.c b/src/sf_util.c index 6f25cea..cf0fd88 100644 --- a/src/sf_util.c +++ b/src/sf_util.c @@ -181,6 +181,11 @@ const char *sf_parse_daemon_mode_and_action_ex(int argc, char *argv[], inc = match_option(argv[i], other_options); if (inc > 0) { i += inc; + if (i > argc) { + fprintf(stderr, "\nError: expect argument!\n"); + sf_usage_ex(argv[0], other_options); + return NULL; + } continue; } }