kernel: be more careful about argc for /dev/drivers writes
Not crashing on 'chdev &' is important.
This commit is contained in:
parent
fe2cbbb402
commit
1d09995353
1 changed files with 7 additions and 3 deletions
|
@ -705,18 +705,22 @@ conswrite(Chan *c, void *va, long n, vlong off)
|
||||||
error(Ebadarg);
|
error(Ebadarg);
|
||||||
if(ct->index != CMchdev)
|
if(ct->index != CMchdev)
|
||||||
error(Ebadarg);
|
error(Ebadarg);
|
||||||
if(cb->nf < 2 || cb->nf > 3)
|
if(cb->nf == 1)
|
||||||
error(Ebadarg);
|
error(Ebadarg);
|
||||||
|
|
||||||
invert = 1;
|
invert = 1;
|
||||||
a = cb->f[2];
|
a = "";
|
||||||
switch(cb->f[1][0]){
|
switch(cb->f[1][0]){
|
||||||
case '&':
|
case '&':
|
||||||
|
if(cb->nf != 3)
|
||||||
|
error(Ebadarg);
|
||||||
|
a = cb->f[2];
|
||||||
if(cb->f[1][1] == '~')
|
if(cb->f[1][1] == '~')
|
||||||
invert--;
|
invert--;
|
||||||
break;
|
break;
|
||||||
case '~':
|
case '~':
|
||||||
a = "";
|
if(cb->nf != 2)
|
||||||
|
error(Ebadarg);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
error(Ebadarg);
|
error(Ebadarg);
|
||||||
|
|
Loading…
Reference in a new issue