summaryrefslogtreecommitdiffhomepage
path: root/src/driver
diff options
context:
space:
mode:
authormidipix <writeonce@midipix.org>2018-08-18 09:59:43 +0000
committermidipix <writeonce@midipix.org>2018-08-18 22:14:06 -0400
commitdc1caf0d2ba8a58caf424bf631254c8e821229ec (patch)
treeef85be313f2301b02f6a29196f10ecd90b5c0b4c /src/driver
parent1cf502784432cb08c930d3629d8dea4898a76352 (diff)
downloadntux-dc1caf0d2ba8a58caf424bf631254c8e821229ec.tar.bz2
ntux-dc1caf0d2ba8a58caf424bf631254c8e821229ec.tar.xz
ntux_get_driver_ctx(): guard against a misplaced --cmd argument.
Diffstat (limited to 'src/driver')
-rw-r--r--src/driver/ntux_driver_ctx.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/src/driver/ntux_driver_ctx.c b/src/driver/ntux_driver_ctx.c
index 243a729..9443ab5 100644
--- a/src/driver/ntux_driver_ctx.c
+++ b/src/driver/ntux_driver_ctx.c
@@ -302,7 +302,20 @@ int ntux_get_driver_ctx(
optv,0,cctx.cmd);
/* initial argv scan: ... --cmd=xxx ... */
- for (parg=argv, cmdargv=0; *parg && !cmdargv; parg++) {
+ argv_scan(argv,optv,&ctx,0);
+
+ /* invalid ntux arguments? */
+ if (ctx.erridx && !ctx.unitidx) {
+ if (flags & NTUX_DRIVER_VERBOSITY_ERRORS)
+ argv_get(
+ argv,optv,
+ ARGV_VERBOSITY_ERRORS,
+ fdctx->fderr);
+ return -1;
+ }
+
+ /* scan for --cmd */
+ for (parg=argv, cmdargv=0; (parg<&argv[ctx.unitidx]) && !cmdargv; parg++) {
if (!strcmp(*parg,"--cmd") && parg[1]) {
cmdargv = &parg[2];
cmdmark = parg[2];