diff options
author | dimitri staessens <dimitri.staessens@intec.ugent.be> | 2016-08-31 14:30:28 +0200 |
---|---|---|
committer | dimitri staessens <dimitri.staessens@intec.ugent.be> | 2016-08-31 14:31:07 +0200 |
commit | c1f31f6c3ca8bd91d0caaa209e2a1592eebf77d5 (patch) | |
tree | 64ca0980ac2f8e19cc945d0932c59daec99e3210 | |
parent | 857c014a40a75eda574af8b2002b1c794bc0975c (diff) | |
download | ouroboros-c1f31f6c3ca8bd91d0caaa209e2a1592eebf77d5.tar.gz ouroboros-c1f31f6c3ca8bd91d0caaa209e2a1592eebf77d5.zip |
tools, irm: Fix segfault with missing parameters
-rw-r--r-- | src/tools/irm/irm_bind_api.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/tools/irm/irm_bind_api.c b/src/tools/irm/irm_bind_api.c index b21d305c..abc21b3d 100644 --- a/src/tools/irm/irm_bind_api.c +++ b/src/tools/irm/irm_bind_api.c @@ -40,7 +40,7 @@ int do_bind_api(int argc, char ** argv) pid_t api = -1; char * name = NULL; - while (argc > 0) { + while (argc > 1) { if (matches(*argv, "name") == 0) { name = *(argv + 1); ++argv; @@ -59,7 +59,7 @@ int do_bind_api(int argc, char ** argv) --argc; } - if (api < 0 || name == NULL) { + if (argc == 1 || api < 0 || name == NULL) { usage(); return -1; } |