From 9943690fc70890c959ad04702fee64cba838c6ed Mon Sep 17 00:00:00 2001 From: Vitaliy Cherepanov Date: Thu, 30 Oct 2014 12:18:46 +0300 Subject: [PATCH] [FIX] MD5 sum in MSG_BINARY_ACK Change-Id: Ie5b8420a255577c355914c1c50748d943e45ca83 Signed-off-by: Vitaliy Cherepanov --- daemon/da_protocol.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/daemon/da_protocol.c b/daemon/da_protocol.c index 14f5b86..8bdc540 100644 --- a/daemon/da_protocol.c +++ b/daemon/da_protocol.c @@ -776,7 +776,10 @@ static size_t binary_ack_pack(char *s, const struct binary_ack *ba) s += len; for (i = 0; i!= 16; ++i) { - snprintf(s, 2, "%02x", ba->digest[i]); + /* we should use snprintf, snprintf prints data including + * terminate '\0' so we need print 3 symbols + */ + snprintf(s, 3, "%02x", ba->digest[i]); s += 2; } *s = '\0'; -- 2.7.4