]> git.meshlink.io Git - meshlink/commitdiff
Fix meta data segfault when receiving a partial command.
authorGuus Sliepen <guus@tinc-vpn.org>
Fri, 19 Oct 2007 19:07:30 +0000 (19:07 +0000)
committerGuus Sliepen <guus@tinc-vpn.org>
Fri, 19 Oct 2007 19:07:30 +0000 (19:07 +0000)
src/meta.c

index 2791ea198c2b4e4471f7e0734a613cff686cc9bf..141a1a1d61200bf265673b95c64441c58b072589 100644 (file)
@@ -106,9 +106,9 @@ bool receive_meta(connection_t *c) {
                        bufp = endp;
                } else {
                        size_t outlen = inlen;
-                       evbuffer_expand(c->buffer->input, inlen);
+                       evbuffer_expand(c->buffer->input, c->buffer->input->off + inlen);
 
-                       if(!cipher_decrypt(&c->incipher, bufp, inlen, c->buffer->input->buffer, &outlen, false) || inlen != outlen) {
+                       if(!cipher_decrypt(&c->incipher, bufp, inlen, c->buffer->input->buffer + c->buffer->input->off, &outlen, false) || inlen != outlen) {
                                logger(LOG_ERR, _("Error while decrypting metadata from %s (%s)"), c->name, c->hostname);
                                return false;
                        }