s += 4;
break;
case 'v':
- if(s+4 > e) goto Err;
+ if(s+8 > e) goto Err;
*va_arg(arg, vlong*) =
(vlong)s[0]<<56 |
(vlong)s[1]<<48 |
afd = -1;
nprocs = 0;
- for(port=6881; port<6890; port++){
+ for(port=6881; port<9000; port++){
snprint(addr, sizeof(addr), "tcp!*!%d", port);
if((afd = announce(addr, adir)) >= 0)
break;
}
}
}
- havepiece(off / blocksize, w->str);
+ if(off < f->off + f->len)
+ havepiece(off / blocksize, w->str);
havepiece(f->off / blocksize, w->str);
close(fd);
exits(0);
if((x = strchr(url, '/')) == nil)
x = strchr(url, 0);
}
- snprint(addr, naddr, "udp!%.*s!%d", (int)(x-url), url, port);
+ snprint(addr, naddr, "udp!%.*s!%d", utfnlen(url, x-url), url, port);
return 0;
}