X-Git-Url: http://git.tuebingen.mpg.de/?a=blobdiff_plain;f=net.c;h=032b02c3f85497724db0f7a580b5acd1d610743c;hb=b9f95dd2fc1800565536d0dcdbfbc6526e7b7349;hp=bc7d234bfa2ec01619d8bc698dfb2841053b0eca;hpb=de25f9d0d999b2a911ecc93d19511ff437211d18;p=paraslash.git diff --git a/net.c b/net.c index bc7d234b..032b02c3 100644 --- a/net.c +++ b/net.c @@ -120,7 +120,7 @@ static int sendall(int fd, const char *buf, size_t *len) total += n; bytesleft -= n; if (total < *len) - PARA_DEBUG_LOG("short write (%zd byte(s) left)", + PARA_DEBUG_LOG("short write (%zd byte(s) left)\n", *len - total); } *len = total; /* return number actually sent here */ @@ -151,7 +151,8 @@ int send_bin_buffer(int fd, const char *buf, size_t len) 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);