chiark / gitweb /
site: Initialise st->scratch with SETUP_BUFFER_LEN space.
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Mon, 5 Aug 2013 10:45:50 +0000 (11:45 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Mon, 5 Aug 2013 10:45:50 +0000 (11:45 +0100)
Otherwise, if we're unlucky, we end up trying to construt a PROD
packet before we have ever used buffer_copy on scratch, which causes
an assertion failure ("buf->size <= buf->len - amount" at util.c:257).

Reported-by: Simon Tatham <anakin@pobox.com>
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
debian/changelog
site.c

index ea1d421..9c75165 100644 (file)
@@ -1,3 +1,10 @@
+secnet (0.3.0~beta3) unstable; urgency=low
+
+  * New upstream version.
+   - Stability bugfix: properly initialise site's scratch buffer.
+
+ --
+
 secnet (0.3.0~beta2) unstable; urgency=low
 
   * New upstream version.
 secnet (0.3.0~beta2) unstable; urgency=low
 
   * New upstream version.
diff --git a/site.c b/site.c
index 0b39232..324a206 100644 (file)
--- a/site.c
+++ b/site.c
@@ -1808,7 +1808,7 @@ static list_t *site_apply(closure_t *self, struct cloc loc, dict_t *context,
 
     buffer_new(&st->buffer,SETUP_BUFFER_LEN);
 
 
     buffer_new(&st->buffer,SETUP_BUFFER_LEN);
 
-    buffer_new(&st->scratch,0);
+    buffer_new(&st->scratch,SETUP_BUFFER_LEN);
     BUF_ALLOC(&st->scratch,"site:scratch");
 
     /* We are interested in poll(), but only for timeouts. We don't have
     BUF_ALLOC(&st->scratch,"site:scratch");
 
     /* We are interested in poll(), but only for timeouts. We don't have