Commit 0db69071 authored by Niels Möller's avatar Niels Möller
Browse files

* read_packet.c (do_read_packet): Signedness fixes.

Rev: src/read_packet.c:1.29
parent 36a1a265
...@@ -133,11 +133,14 @@ static int do_read_packet(struct read_handler **h, ...@@ -133,11 +133,14 @@ static int do_read_packet(struct read_handler **h,
/* FIXME: Free associated resources! */ /* FIXME: Free associated resources! */
return LSH_OK | LSH_CLOSE; return LSH_OK | LSH_CLOSE;
} }
assert(n > 0);
closure->pos += n; closure->pos += n;
total += n; total += n;
/* Read a complete block? */ /* Read a complete block? */
if (n == left) if ( (unsigned) n == left)
{ {
UINT32 length; UINT32 length;
...@@ -216,11 +219,14 @@ static int do_read_packet(struct read_handler **h, ...@@ -216,11 +219,14 @@ static int do_read_packet(struct read_handler **h,
/* FIXME: Free associated resources! */ /* FIXME: Free associated resources! */
return LSH_FAIL | LSH_DIE; return LSH_FAIL | LSH_DIE;
} }
assert(n > 0);
closure->pos += n; closure->pos += n;
total += n; total += n;
/* Read a complete packet? */ /* Read a complete packet? */
if (n == left) if ( (unsigned) n == left)
{ {
UINT32 left UINT32 left
= ( (closure->buffer->length + closure->buffer->data) = ( (closure->buffer->length + closure->buffer->data)
...@@ -262,11 +268,14 @@ static int do_read_packet(struct read_handler **h, ...@@ -262,11 +268,14 @@ static int do_read_packet(struct read_handler **h,
/* FIXME: Free associated resources! */ /* FIXME: Free associated resources! */
return LSH_FAIL | LSH_DIE; return LSH_FAIL | LSH_DIE;
} }
assert(n > 0);
closure->pos += n; closure->pos += n;
total += n; total += n;
/* Read complete mac? */ /* Read complete mac? */
if (n == left) if ( (unsigned) n == left)
{ {
mac = alloca(closure->connection->rec_mac->hash_size); mac = alloca(closure->connection->rec_mac->hash_size);
HASH_DIGEST(closure->connection->rec_mac, mac); HASH_DIGEST(closure->connection->rec_mac, mac);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment