You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by cc...@apache.org on 2019/07/29 18:53:58 UTC

[mynewt-core] 03/04: sys/log/full: Fix buffer overrun

This is an automated email from the ASF dual-hosted git repository.

ccollins pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-core.git

commit 71b75a80aa4fed540d99183f8d018e873a4bb5f4
Author: Christopher Collins <cc...@apache.org>
AuthorDate: Tue Jun 4 17:13:17 2019 -0700

    sys/log/full: Fix buffer overrun
    
    In `log_fcb_copy_entry()`, the code was null-terminating the destination
    buffer without reserving space for the terminator.
    
    Null termination is not necessary here.  We are just copying an entry
    from one FCB to another, so there is no need to modify the entry body.
---
 sys/log/full/src/log_fcb.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/sys/log/full/src/log_fcb.c b/sys/log/full/src/log_fcb.c
index 57ac1c0..bfa4009 100644
--- a/sys/log/full/src/log_fcb.c
+++ b/sys/log/full/src/log_fcb.c
@@ -681,7 +681,6 @@ log_fcb_copy_entry(struct log *log, struct fcb_entry *entry,
     if (rc < 0) {
         goto err;
     }
-    data[rc] = '\0';
 
     /* Changing the fcb to be logged to be dst fcb */
     fcb_tmp = &((struct fcb_log *)log->l_arg)->fl_fcb;