X-Git-Url: https://tinc-vpn.org/git/browse?a=blobdiff_plain;f=src%2Fmeta.c;h=ac937750b5933b90db4230a542a36cd477d9ab3d;hb=8de8f1d9e2c2c02d4a14a5506e7d0d914dc328da;hp=726dcca924ca5dcf692bfaa2acd2b9dc4df38bd2;hpb=cdb793f687262b9f56823ca9046523a609a758af;p=tinc diff --git a/src/meta.c b/src/meta.c index 726dcca9..ac937750 100644 --- a/src/meta.c +++ b/src/meta.c @@ -42,10 +42,9 @@ bool send_meta(connection_t *c, const char *buffer, int length) { /* Add our data to buffer */ if(c->status.encryptout) { - char outbuf[length]; size_t outlen = length; - if(!cipher_encrypt(&c->outcipher, outbuf, length, buffer_prepare(&c->outbuf, length), &outlen, false) || outlen != length) { + if(!cipher_encrypt(&c->outcipher, buffer, length, buffer_prepare(&c->outbuf, length), &outlen, false) || outlen != length) { logger(LOG_ERR, "Error while encrypting metadata to %s (%s)", c->name, c->hostname); return false; @@ -73,7 +72,7 @@ void broadcast_meta(connection_t *from, const char *buffer, int length) { } bool receive_meta(connection_t *c) { - int inlen, reqlen; + int inlen; char inbuf[MAXBUFSIZE]; char *bufp = inbuf, *endp; @@ -152,5 +151,7 @@ bool receive_meta(connection_t *c) { } } while(inlen); + buffer_compact(&c->inbuf); + return true; }