diff options
author | Simon Rettberg | 2015-02-19 13:54:07 +0100 |
---|---|---|
committer | Simon Rettberg | 2015-02-19 13:54:07 +0100 |
commit | 7a12ea32789c652cdbe6fc98b5b93724d6599635 (patch) | |
tree | a956d717e5d675397c67b5d6ae8667afb0be7530 | |
parent | [SERVER] Fix two minor bugs: Replication stall, integrity checker 100% CPU usage (diff) | |
download | dnbd3-7a12ea32789c652cdbe6fc98b5b93724d6599635.tar.gz dnbd3-7a12ea32789c652cdbe6fc98b5b93724d6599635.tar.xz dnbd3-7a12ea32789c652cdbe6fc98b5b93724d6599635.zip |
[SERVER] Fix really stupid bug where received data gets written to random memory
-rw-r--r-- | src/server/protocol.h | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/server/protocol.h b/src/server/protocol.h index ad286d1..41c6410 100644 --- a/src/server/protocol.h +++ b/src/server/protocol.h @@ -24,7 +24,7 @@ static inline int dnbd3_read_reply(int sock, dnbd3_reply_t *reply, bool wait) if ( errno == EINTR ) return REPLY_INTR; return REPLY_ERRNO; } - if ( !wait && ret != sizeof(*reply) ) ret += recv( sock, reply + ret, sizeof(*reply) - ret, MSG_WAITALL | MSG_NOSIGNAL ); + if ( !wait && ret != sizeof(*reply) ) ret += recv( sock, ((char*)reply) + ret, sizeof(*reply) - ret, MSG_WAITALL | MSG_NOSIGNAL ); if ( ret != sizeof(*reply) ) return REPLY_INCOMPLETE; fixup_reply( *reply ); if ( reply->magic != dnbd3_packet_magic ) return REPLY_WRONGMAGIC; |