Fix meta data segfault when receiving a partial command.

This commit is contained in:
Guus Sliepen 2007-10-19 19:07:30 +00:00
parent 67d9a72ea2
commit b0709d2649

View file

@ -106,9 +106,9 @@ bool receive_meta(connection_t *c) {
bufp = endp; bufp = endp;
} else { } else {
size_t outlen = inlen; 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); logger(LOG_ERR, _("Error while decrypting metadata from %s (%s)"), c->name, c->hostname);
return false; return false;
} }