kernel: dont rely on atoi() parsing hex for netif/devbridge

This commit is contained in:
cinap_lenrek 2015-08-03 16:24:14 +02:00
parent 887ae1a17b
commit 1b7e120c09
2 changed files with 3 additions and 3 deletions

View file

@ -537,7 +537,7 @@ portbind(Bridge *b, int argc, char *argv[])
dev2 = argv[4]; dev2 = argv[4];
} else } else
error(usage); error(usage);
ownhash = atoi(argv[2]); ownhash = strtoul(argv[2], 0, 0);
dev = argv[3]; dev = argv[3];
for(i=0; i<b->nport; i++) { for(i=0; i<b->nport; i++) {
port = b->port[i]; port = b->port[i];
@ -643,7 +643,7 @@ portunbind(Bridge *b, int argc, char *argv[])
} else } else
error(usage); error(usage);
if(argc == 3) if(argc == 3)
ownhash = atoi(argv[2]); ownhash = strtoul(argv[2], 0, 0);
else else
ownhash = 0; ownhash = 0;
for(i=0; i<b->nport; i++) { for(i=0; i<b->nport; i++) {

View file

@ -308,7 +308,7 @@ netifwrite(Netif *nif, Chan *c, void *a, long n)
qlock(nif); qlock(nif);
f = nif->f[NETID(c->qid.path)]; f = nif->f[NETID(c->qid.path)];
if((p = matchtoken(buf, "connect")) != 0){ if((p = matchtoken(buf, "connect")) != 0){
type = atoi(p); type = strtoul(p, 0, 0);
if(typeinuse(nif, type)) if(typeinuse(nif, type))
error(Einuse); error(Einuse);
f->type = type; f->type = type;