git: 9front

Download patch

ref: 5350c98adebfae1bd9112a38ab0c23a62d339bf3
parent: 631100ab58f21151037ffa28ed0fefef75e312e1
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;
--