Add patches to fix two annoying crashes, from Aaron Stellman.

ok sthen
This commit is contained in:
nicm 2010-01-11 22:53:35 +00:00
parent 65db608ab5
commit 515534d9f4
3 changed files with 39 additions and 2 deletions

View File

@ -1,9 +1,9 @@
# $OpenBSD: Makefile,v 1.7 2009/12/31 21:33:42 nicm Exp $
# $OpenBSD: Makefile,v 1.8 2010/01/11 22:53:35 nicm Exp $
COMMENT= BitTorrent Protocol Daemon
DISTNAME= btpd-0.15
PKGNAME= ${DISTNAME}p0
PKGNAME= ${DISTNAME}p1
CATEGORIES= net
MAINTAINER= Nicholas Marriott <nicm@openbsd.org>

View File

@ -0,0 +1,12 @@
$OpenBSD: patch-btpd_addrinfo_c,v 1.1 2010/01/11 22:53:35 nicm Exp $
--- btpd/addrinfo.c.orig Wed Dec 23 18:45:51 2009
+++ btpd/addrinfo.c Wed Dec 23 18:45:54 2009
@@ -52,7 +52,7 @@ addrinfo_td_cb(void *arg)
struct ai_ctx *ctx = arg;
if (!ctx->cancel)
ctx->cb(ctx->arg, ctx->error, ctx->res);
- else if (ctx->error != 0)
+ else if (ctx->res != NULL)
freeaddrinfo(ctx->res);
free(ctx);
}

View File

@ -0,0 +1,25 @@
$OpenBSD: patch-misc_http_client_c,v 1.1 2010/01/11 22:53:35 nicm Exp $
--- misc/http_client.c.orig Mon Jan 12 14:43:18 2009
+++ misc/http_client.c Tue Dec 22 23:19:29 2009
@@ -230,6 +230,12 @@ again:
else
goto error;
}
+
+ /* req->rbuf.buf may be reallocated inside iobuf_write()
+ * so we should calculate the offset before that happens
+ */
+ size_t consumed = end - (char *)req->rbuf.buf + dlen;
+
if (!iobuf_write(&req->rbuf, "", 1))
goto error;
req->rbuf.off--;
@@ -237,7 +243,7 @@ again:
goto error;
if (req->cancel)
goto cancel;
- iobuf_consumed(&req->rbuf, end - (char *)req->rbuf.buf + dlen);
+ iobuf_consumed(&req->rbuf, consumed);
goto again;
case PS_CHUNK_SIZE:
assert(req->chunked);