cf = crypt_data_array[fd].send;
if (cf) {
void *private = crypt_data_array[fd].private_data;
- unsigned char *outbuf = para_malloc(len);
+ /* RC4 may write more than len to the output buffer */
+ unsigned char *outbuf = para_malloc(ROUND_UP(len, 8));
(*cf)(len, (unsigned char *)buf, outbuf, private);
ret = sendall(fd, (char *)outbuf, &len);
free(outbuf);