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

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


The following commit(s) were added to refs/heads/master by this push:
     new 6c613b9  sys/console/full: Fix semihosting pointer arithmetic
6c613b9 is described below

commit 6c613b91ac6ec09db77205462b678e5da0e72198
Author: Casper Meijn <cas...@meijn.net>
AuthorDate: Sun May 10 08:12:16 2020 +0200

    sys/console/full: Fix semihosting pointer arithmetic
    
    The semihosting buffer was flush a byte too late, this caused a buffer
    overflow.
---
 sys/console/full/src/semihosting_console.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys/console/full/src/semihosting_console.c 
b/sys/console/full/src/semihosting_console.c
index 1065b4e..a334eaf 100644
--- a/sys/console/full/src/semihosting_console.c
+++ b/sys/console/full/src/semihosting_console.c
@@ -44,7 +44,7 @@ semihosting_console_write(unsigned char c)
 {
     *semihosting_tx_buffer_pos = c;
     semihosting_tx_buffer_pos++;
-    if (semihosting_tx_buffer_pos > semihosting_tx_buffer + 
sizeof(semihosting_tx_buffer)) {
+    if (semihosting_tx_buffer_pos >= semihosting_tx_buffer + 
sizeof(semihosting_tx_buffer)) {
         semihosting_console_flush();
     }
 }

Reply via email to