[][[Logan] mwctl command segmentation fault]
[Description]
if run mwctl command without arguments.
it will throw segmentation fault.
root@OpenWrt:~# mwctl
Segmentation fault (core dumped)
[Release-log]
Change-Id: I79f1cb9099168da261eb6903c14ae38857da5a8b
diff --git a/feed/mwctl/src/main.c b/feed/mwctl/src/main.c
index e2421f2..af7b31e 100755
--- a/feed/mwctl/src/main.c
+++ b/feed/mwctl/src/main.c
@@ -80,7 +80,13 @@
progname = argv[0];
- if_idx = if_nametoindex(argv[1]);
+ if(argv[1])
+ if_idx = if_nametoindex(argv[1]);
+ else {
+ fprintf(stderr, "wrong argument\n");
+ usage();
+ }
+
if (!if_idx) {
fprintf(stderr, "%s\n", strerror(errno));
return 2;