chiark / gitweb /
SECURITY: actually reject messages with improper lengths
[secnet.git] / util.c
diff --git a/util.c b/util.c
index 63fe76f4451a80e2a6c266fffb8c1aabd878d20f..086c23440ffd1fc592495b5235277a9e104f063d 100644 (file)
--- a/util.c
+++ b/util.c
@@ -269,6 +269,7 @@ void *buf_unappend(struct buffer_if *buf, int32_t amount) {
 
 void *buf_unprepend(struct buffer_if *buf, int32_t amount) {
     void *p;
+    if (buf->size < amount) return 0;
     p=buf->start;
     buf->start+=amount;
     buf->size-=amount;