diff --git a/src/daemon/toks_daemon_ioctl.c b/src/daemon/toks_daemon_ioctl.c index 373e525..221d3ed 100644 --- a/src/daemon/toks_daemon_ioctl.c +++ b/src/daemon/toks_daemon_ioctl.c @@ -26,7 +26,10 @@ static int32_t toks_daemon_ioctl_set_token_count(struct toks_daemon_ctx * dctx) msg = &dctx->reply; ntokens = (int)(intptr_t)msg->ttyinfo.exarg; - if (ntokens > toks_get_driver_atokens(dctx->driver_ctx)) + if (ntokens < 0) + return NT_STATUS_INVALID_PARAMETER; + + else if (ntokens > toks_get_driver_atokens(dctx->driver_ctx)) return NT_STATUS_BUFFER_TOO_SMALL; toks_set_driver_ntokens(dctx->driver_ctx,ntokens);