From: root Date: Thu, 19 Jun 2008 17:14:32 +0000 (-0500) Subject: net: Fix crash when specifying invalid options on the command line X-Git-Tag: samba-3.3.0pre1~831 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=4c3bfea9f8d238f9100eaa264b9b2941dff5a6dd;p=thirdparty%2Fsamba.git net: Fix crash when specifying invalid options on the command line --- 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)