X-Git-Url: http://git.tuebingen.mpg.de/?p=paraslash.git;a=blobdiff_plain;f=crypt_common.c;h=4e9622e4ee773d65c708bbf3f0b624592ed0e27b;hp=8de346c74b47468a15c566cae29a4ff484b056c6;hb=6a7ba04cacab72c9787c4b0427e36cedd5adefcf;hpb=82d08fb6da4dfc7d93d1ee0cce4706721378fe12 diff --git a/crypt_common.c b/crypt_common.c index 8de346c7..4e9622e4 100644 --- a/crypt_common.c +++ b/crypt_common.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2005-2011 Andre Noll + * Copyright (C) 2005-2012 Andre Noll * * Licensed under the GPL v2. For licencing details see COPYING. */ @@ -7,7 +7,6 @@ /** \file crypt_common.c Crypto functions independent of openssl/libgcrypt. */ #include -#include #include "para.h" #include "error.h" @@ -338,7 +337,12 @@ int sc_recv_buffer(struct stream_cipher_context *scc, char *buf, size_t size) int sc_send_buffer(struct stream_cipher_context *scc, char *buf) { - return sc_send_bin_buffer(scc, buf, strlen(buf)); + size_t len = strlen(buf); + int ret = sc_send_bin_buffer(scc, buf, len); + + if (ret < 0 || ret == len) + return ret; + return -E_SHORT_WRITE; } __printf_2_3 int sc_send_va_buffer(struct stream_cipher_context *scc,