- RC4(key, src->iov_len, src->iov_base, dst->iov_base);
- ((char *)dst->iov_base)[dst->iov_len] = '\0';
+ RC4(key, l1, src->iov_base, dst->iov_base);
+ if (len > l1) {
+ unsigned char remainder[RC4_ALIGN] = "";
+ memcpy(remainder, src->iov_base + l1, len - l1);
+ RC4(key, len - l1, remainder, dst->iov_base + l1);
+ }
+ ((char *)dst->iov_base)[len] = '\0';