Repository: incubator-mynewt-core
Updated Branches:
  refs/heads/develop bed47f0ab -> 60d74cfc5


boot_serial; fix unittest.


Project: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/repo
Commit: 
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/commit/60d74cfc
Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/tree/60d74cfc
Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/diff/60d74cfc

Branch: refs/heads/develop
Commit: 60d74cfc5357a12a8db1adfe44ef2fa5949910bf
Parents: bed47f0
Author: Marko Kiiskila <ma...@runtime.io>
Authored: Fri Oct 7 17:08:22 2016 -0700
Committer: Marko Kiiskila <ma...@runtime.io>
Committed: Tue Oct 11 08:12:52 2016 -0700

----------------------------------------------------------------------
 boot/boot_serial/test/src/boot_test.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/60d74cfc/boot/boot_serial/test/src/boot_test.c
----------------------------------------------------------------------
diff --git a/boot/boot_serial/test/src/boot_test.c 
b/boot/boot_serial/test/src/boot_test.c
index b965bcd..384606b 100644
--- a/boot/boot_serial/test/src/boot_test.c
+++ b/boot/boot_serial/test/src/boot_test.c
@@ -84,7 +84,7 @@ TEST_CASE(boot_serial_empty_img_msg)
 TEST_CASE(boot_serial_img_msg)
 {
     char img[16];
-    char enc_img[BASE64_ENCODE_SIZE(sizeof(img))];
+    char enc_img[BASE64_ENCODE_SIZE(sizeof(img)) + 1];
     char buf[sizeof(struct nmgr_hdr) + sizeof(enc_img) + 32];
     int len;
     int rc;
@@ -94,6 +94,7 @@ TEST_CASE(boot_serial_img_msg)
     memset(img, 0xa5, sizeof(img));
     len = base64_encode(img, sizeof(img), enc_img, 1);
     assert(len > 0);
+    enc_img[len] = '\0';
 
     hdr = (struct nmgr_hdr *)buf;
     memset(hdr, 0, sizeof(*hdr));
@@ -139,6 +140,7 @@ TEST_CASE(boot_serial_upload_bigger_image)
     for (off = 0; off < sizeof(img); off += 32) {
         len = base64_encode(&img[off], 32, enc_img, 1);
         assert(len > 0);
+        enc_img[len] = '\0';
 
         hdr = (struct nmgr_hdr *)buf;
         memset(hdr, 0, sizeof(*hdr));

Reply via email to