aboutsummaryrefslogtreecommitdiffstats
path: root/marshal.c
diff options
context:
space:
mode:
authorMattias Andrée <maandree@kth.se>2019-02-10 11:28:30 +0100
committerMattias Andrée <maandree@kth.se>2019-02-10 11:28:30 +0100
commitd84edd9500e6e22ba49c76dc93a7c0731755d008 (patch)
tree5238a0362e0f70ea44fa40906c86102d5a50a4eb /marshal.c
parentFix warnings (diff)
downloadlibsha2-d84edd9500e6e22ba49c76dc93a7c0731755d008.tar.gz
libsha2-d84edd9500e6e22ba49c76dc93a7c0731755d008.tar.bz2
libsha2-d84edd9500e6e22ba49c76dc93a7c0731755d008.tar.xz
Fix libsha2_digest + minor improvements
Signed-off-by: Mattias Andrée <maandree@kth.se>
Diffstat (limited to '')
-rw-r--r--marshal.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/marshal.c b/marshal.c
index 8265c38..75a8749 100644
--- a/marshal.c
+++ b/marshal.c
@@ -47,11 +47,11 @@ libsha2_marshal(const struct libsha2_state *restrict state, char *restrict buf)
}
if (buf)
- memcpy(&buf[off], state->chunk, sizeof(state->chunk));
- off += sizeof(state->chunk);
- if (buf)
*(size_t *)&buf[off] = state->chunk_size;
off += sizeof(size_t);
+ if (buf)
+ memcpy(&buf[off], state->chunk, state->chunk_size);
+ off += state->chunk_size;
return off;
}