This is an automated email from Gerrit.

Adrian M Negreanu ([email protected]) just uploaded a new patch set to 
Gerrit, which you can find at http://openocd.zylin.com/5925

-- gerrit

commit 1deb8b8d09087c88676e14739abfc66b91de3aed
Author: Adrian Negreanu <[email protected]>
Date:   Thu Nov 5 23:15:16 2020 +0200

    semihosting, SYS_GET_CMDLINE: check CommandLine to be at most 255 bytes
    
    The specs for semihosting are not mentioning any maximum size for the
    command line.
    
    ARMGCC toolchain is using Newlib, which has a CommandLine of 255 bytes.
    
    Change-Id: I41fc3b5fb7bcb61f5f06602cc01043aebd5d448f
    Signed-off-by: Adrian Negreanu <[email protected]>

diff --git a/src/target/semihosting_common.c b/src/target/semihosting_common.c
index 9650556..2f25279 100644
--- a/src/target/semihosting_common.c
+++ b/src/target/semihosting_common.c
@@ -507,7 +507,9 @@ int semihosting_common(struct target *target)
                                char *arg = semihosting->cmdline != NULL ?
                                        semihosting->cmdline : "";
                                uint32_t len = strlen(arg) + 1;
-                               if (len > size)
+                               if (size > 255) /* rdimon's CommandLine size */
+                                       semihosting->result = -1;
+                               else if (len > size)
                                        semihosting->result = -1;
                                else {
                                        semihosting_set_field(target, len, 1, 
fields);

-- 


_______________________________________________
OpenOCD-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/openocd-devel

Reply via email to