shithub: riscv

Download patch

ref: b1c9ddb3f0757d900e3d51c82f73b196d5631ef7
parent: fd277c053d8cbc1b9bbd930670e032c1427ea0a8
author: cinap_lenrek <[email protected]>
date: Mon Feb 11 18:42:15 EST 2019

ndb/dns: provide v4 argument to parseipmask(), use snprint() instead of sprint()

--- a/sys/src/cmd/ndb/dblookup.c
+++ b/sys/src/cmd/ndb/dblookup.c
@@ -1013,7 +1013,7 @@
 {
 	int len, dlen, n;
 	char *dom;
-	char buf[Domlen], ipa[48];
+	char buf[Domlen], ipa[64];
 	char *f[40];
 	uchar net[IPaddrlen], mask[IPaddrlen];
 	Area *s;
@@ -1057,7 +1057,7 @@
 			net[IPv4off+1] = atoi(f[2]);
 			net[IPv4off+2] = atoi(f[1]);
 			net[IPv4off+3] = atoi(f[0]);
-			sprint(ipa, "%I", net);
+			snprint(ipa, sizeof(ipa), "%I", net);
 			t = ndbipinfo(db, "ip", ipa, attribs, 1);
 			if(t == nil)	/* could be a reverse with no forward */
 				continue;
@@ -1066,7 +1066,7 @@
 				ndbfree(t);
 				continue;
 			}
-			parseipmask(mask, nt->val);
+			parseipmask(mask, nt->val, 1);
 			ndbfree(t);
 			n = 5;
 			break;