[PATCH] site: Initialise st->scratch with SETUP_BUFFER_LEN space.

Ian Jackson ijackson at chiark.greenend.org.uk
Mon Aug 5 11:51:46 BST 2013


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 at pobox.com>
Signed-off-by: Ian Jackson <ijackson at chiark.greenend.org.uk>
---
 debian/changelog |    7 +++++++
 site.c           |    2 +-
 2 files changed, 8 insertions(+), 1 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index ea1d421..9c75165 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -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.
diff --git a/site.c b/site.c
index 0b39232..324a206 100644
--- 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->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
-- 
1.7.2.5




More information about the sgo-software-discuss mailing list