From 4c3bfea9f8d238f9100eaa264b9b2941dff5a6dd Mon Sep 17 00:00:00 2001 From: root Date: Thu, 19 Jun 2008 12:14:32 -0500 Subject: [PATCH] net: Fix crash when specifying invalid options on the command line --- source/utils/net_util.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/source/utils/net_util.c b/source/utils/net_util.c index 6029231d746..8938b9cf014 100644 --- a/source/utils/net_util.c +++ b/source/utils/net_util.c @@ -550,6 +550,14 @@ int net_run_function(struct net_context *c, int argc, const char **argv, const char *whoami, struct functable *table) { int i; + + if (!table) { + d_fprintf(stderr, "Invalid command. Run \"%s\" for more details.\n", + whoami); + return 1; + } + + if (argc != 0) { for (i=0; table[i].funcname != NULL; i++) { if (StrCaseCmp(argv[0], table[i].funcname) == 0) -- 2.47.3