Mercurial > illumos > illumos-gate
changeset 13741:1e57a183c0e9
1799 ipadm create-addr arg validation crash
Reviewed by: Jason King <jason.brian.king@gmail.com>
Reviewed by: Dan McDonald <danmcd@nexenta.com>
Approved by: Richard Lowe <richlowe@richlowe.net>
author | Yuri Pankov <yuri.pankov@nexenta.com> |
---|---|
date | Wed, 27 Jun 2012 22:10:40 -0500 |
parents | 836bfdf31fc4 |
children | b6bbdd77139c |
files | usr/src/cmd/cmd-inet/usr.sbin/ipadm/ipadm.c |
diffstat | 1 files changed, 10 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- a/usr/src/cmd/cmd-inet/usr.sbin/ipadm/ipadm.c Tue Jun 05 18:33:58 2012 +0200 +++ b/usr/src/cmd/cmd-inet/usr.sbin/ipadm/ipadm.c Wed Jun 27 22:10:40 2012 -0500 @@ -20,6 +20,7 @@ */ /* * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright 2012 Nexenta Systems, Inc. All rights reserved. */ #include <arpa/inet.h> #include <errno.h> @@ -85,13 +86,11 @@ /* address management related sub-commands */ { "create-addr", do_create_addr, - "\tcreate-addr\t[-t] {-T static <static_args> |" - " -T dhcp <dhcp_args> |\n" - "\t\t\t-T addrconf <addrconf_args>} <addrobj>\n" - "\t\t\tstatic_args = <[-d] -a {local|remote}=addr[/prefixlen]>\n" - "\t\t\tdhcp_args = <[-w <seconds> | forever]>\n" - "\t\t\taddrconf_args = <[-i interface-id]\n" - "\t\t\t\t\t[-p {stateful|stateless}={yes|no}]>" }, + "\tcreate-addr\t[-t] -T static [-d] " + "-a{local|remote}=addr[/prefixlen]\n\t\t\t<addrobj>\n" + "\tcreate-addr\t[-t] -T dhcp [-w <seconds> | forever] <addrobj>\n" + "\tcreate-addr\t[-t] -T addrconf [-i interface-id]\n" + "\t\t\t[-p {stateful|stateless}={yes|no}] <addrobj>" }, { "down-addr", do_down_addr, "\tdown-addr\t[-t] <addrobj>" }, { "up-addr", do_up_addr, "\tup-addr\t\t[-t] <addrobj>" }, { "disable-addr", do_disable_addr, "\tdisable-addr\t-t <addrobj>" }, @@ -1194,6 +1193,8 @@ case P_STATELESS: if (stateless_arg) die("Duplicate option"); + if (val == NULL) + die("Invalid argument"); if (strcmp(val, "yes") == 0) stateless = _B_TRUE; else if (strcmp(val, "no") == 0) @@ -1205,6 +1206,8 @@ case P_STATEFUL: if (stateful_arg) die("Duplicate option"); + if (val == NULL) + die("Invalid argument"); if (strcmp(val, "yes") == 0) stateful = _B_TRUE; else if (strcmp(val, "no") == 0)