The following commit has been merged in the master branch:
commit b3e03cf33bda6b6061c1aced6ac63bbcd874e9a6
Author: Guillem Jover <[EMAIL PROTECTED]>
Date: Thu Jun 19 08:06:00 2008 +0300
libdpkg: Do not segfault on varbufdupc after extending the buffer
Store the old used size instead of the precomputed address, as
varbufextend might change the buffer from under us.
diff --git a/ChangeLog b/ChangeLog
index fd9fd9a..b512d80 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2008-06-19 Guillem Jover <[EMAIL PROTECTED]>
+
+ * lib/varbuf.c (varbufdupc): Store the old used size instead of the
+ precomputed address, as varbufextend might change the buffer from
+ under us.
+
2008-06-17 Guillem Jover <[EMAIL PROTECTED]>
* scripts/dpkg-divert.pl: Do not silently force --rename on --remove.
diff --git a/lib/varbuf.c b/lib/varbuf.c
index ffcc544..67722d2 100644
--- a/lib/varbuf.c
+++ b/lib/varbuf.c
@@ -35,11 +35,12 @@ varbufaddc(struct varbuf *v, int c)
}
void varbufdupc(struct varbuf *v, int c, ssize_t n) {
- char *b = v->buf + v->used;
+ size_t old_used = v->used;
+
v->used += n;
if (v->used >= v->size) varbufextend(v);
- memset(b, c, n);
+ memset(v->buf + old_used, c, n);
}
int varbufprintf(struct varbuf *v, const char *fmt, ...) {
--
dpkg's main repository
--
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]