shithub: riscv

Download patch

ref: 1b7e120c090af2f8f0e17a664ba0e5e5d7f261a0
parent: 887ae1a17b54babf6a0946872bf6faaac1427be1
author: cinap_lenrek <cinap_lenrek@felloff.net>
date: Mon Aug 3 12:24:14 EDT 2015

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

--- a/sys/src/9/port/devbridge.c
+++ b/sys/src/9/port/devbridge.c
@@ -537,7 +537,7 @@
 		dev2 = argv[4];
 	} else
 		error(usage);
-	ownhash = atoi(argv[2]);
+	ownhash = strtoul(argv[2], 0, 0);
 	dev = argv[3];
 	for(i=0; i<b->nport; i++) {
 		port = b->port[i];
@@ -643,7 +643,7 @@
 	} else
 		error(usage);
 	if(argc == 3)
-		ownhash = atoi(argv[2]);
+		ownhash = strtoul(argv[2], 0, 0);
 	else
 		ownhash = 0;
 	for(i=0; i<b->nport; i++) {
--- a/sys/src/9/port/netif.c
+++ b/sys/src/9/port/netif.c
@@ -308,7 +308,7 @@
 	qlock(nif);
 	f = nif->f[NETID(c->qid.path)];
 	if((p = matchtoken(buf, "connect")) != 0){
-		type = atoi(p);
+		type = strtoul(p, 0, 0);
 		if(typeinuse(nif, type))
 			error(Einuse);
 		f->type = type;