Browse Source

Plan 9 from Bell Labs 2008-04-18

David du Colombier 12 years ago
parent
commit
5fc77098d4
4 changed files with 14 additions and 7 deletions
  1. 1 0
      dist/replica/_plan9.db
  2. 1 1
      dist/replica/plan9.db
  3. 1 0
      dist/replica/plan9.log
  4. 11 6
      sys/src/libndb/ndbipinfo.c

+ 1 - 0
dist/replica/_plan9.db

@@ -15884,3 +15884,4 @@ usr/glenda/lib/profile - 664 glenda glenda 1105128663 890
 usr/glenda/readme.acme - 664 glenda glenda 1019860628 4753
 usr/glenda/readme.rio - 664 glenda glenda 1019860628 6370
 usr/glenda/tmp - 20000000775 glenda glenda 1018802620 0
+sys/src/libndb/ndbipinfo.c - 664 sys sys 1208488938 5259

+ 1 - 1
dist/replica/plan9.db

@@ -15586,7 +15586,7 @@ sys/src/libndb/ndbgetipaddr.c - 664 sys sys 1144174489 876
 sys/src/libndb/ndbgetval.c - 664 sys sys 1144174490 1348
 sys/src/libndb/ndbhash.c - 664 sys sys 1144174490 5276
 sys/src/libndb/ndbhf.h - 664 sys sys 1015013485 746
-sys/src/libndb/ndbipinfo.c - 664 sys sys 1176931776 5181
+sys/src/libndb/ndbipinfo.c - 664 sys sys 1208488938 5259
 sys/src/libndb/ndblookval.c - 664 sys sys 1078839929 791
 sys/src/libndb/ndbopen.c - 664 sys sys 1173737251 2717
 sys/src/libndb/ndbparse.c - 664 sys sys 1144174490 1207

+ 1 - 0
dist/replica/plan9.log

@@ -18997,3 +18997,4 @@
 1208359804 0 a lib/face/48x48x8/u/usps.1 - 664 sys sys 1208359251 852
 1208359804 1 c sys/src/cmd/page/view.c - 664 sys sys 1208359650 22159
 1208376004 0 c 386/bin/page - 775 sys sys 1208375716 236269
+1208489405 0 c sys/src/libndb/ndbipinfo.c - 664 sys sys 1208488938 5259

+ 11 - 6
sys/src/libndb/ndbipinfo.c

@@ -162,10 +162,9 @@ ndbipinfo(Ndb *db, char *attr, char *val, char **alist, int n)
 	Ndbtuple *t, *nt, *f;
 	Ndbs s;
 	char *ipstr;
-	uchar net[IPaddrlen];
-	uchar ip[IPaddrlen];
-	int prefix, smallestprefix;
-	int force;
+	uchar net[IPaddrlen], ip[IPaddrlen];
+	int prefix, smallestprefix, force;
+	vlong r;
 
 	/* just in case */
 	fmtinstall('I', eipfmt);
@@ -188,7 +187,9 @@ ndbipinfo(Ndb *db, char *attr, char *val, char **alist, int n)
 		t = ndbnew("ip", val);
 		t->line = t;
 		t->entry = nil;
-		parseip(net, val);
+		r = parseip(net, val);
+		if(r == -1)
+			ndbfree(t);
 	} else {
 		/* found one */
 		while(nt != nil){
@@ -196,9 +197,13 @@ ndbipinfo(Ndb *db, char *attr, char *val, char **alist, int n)
 			t = ndbconcatenate(t, nt);
 			nt = ndbsnext(&s, attr, val);
 		}
-		parseip(net, ipstr);
+		r = parseip(net, ipstr);
 		free(ipstr);
 	}
+	if(r < 0){
+		ndbfree(f);
+		return nil;
+	}
 	ipmove(ip, net);
 	t = filter(db, t, f);