Several fixes for the buffer code.

This commit is contained in:
Guus Sliepen 2011-05-14 22:30:23 +02:00
parent cdb793f687
commit ffa3a443b9
3 changed files with 17 additions and 6 deletions

View file

@ -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;
@ -152,5 +151,7 @@ bool receive_meta(connection_t *c) {
}
} while(inlen);
buffer_compact(&c->inbuf);
return true;
}