diff options
author | Tomas Vanek <vanekt@fbl.cz> | 2018-02-16 11:58:10 +0100 |
---|---|---|
committer | Tomas Vanek <vanekt@fbl.cz> | 2018-03-15 17:10:33 +0000 |
commit | a4cdce0129a6b206a2081d77dd518ce2cae0b71f (patch) | |
tree | 8e38765a2283e7ccd36aa39eaab13ed1e6dc91b6 /src | |
parent | ff23980434b3be523853034c71e61662303aa742 (diff) | |
download | riscv-openocd-a4cdce0129a6b206a2081d77dd518ce2cae0b71f.zip riscv-openocd-a4cdce0129a6b206a2081d77dd518ce2cae0b71f.tar.gz riscv-openocd-a4cdce0129a6b206a2081d77dd518ce2cae0b71f.tar.bz2 |
gdb_server: prevent false positive valgrind report
Change-Id: Ia59fdf8a23043889840122859b0c5bdb5f757703
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: http://openocd.zylin.com/4420
Tested-by: jenkins
Diffstat (limited to 'src')
-rw-r--r-- | src/server/gdb_server.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/server/gdb_server.c b/src/server/gdb_server.c index c521769..2acebe8 100644 --- a/src/server/gdb_server.c +++ b/src/server/gdb_server.c @@ -2442,7 +2442,11 @@ static int gdb_get_thread_list_chunk(struct target *target, char **thread_list, else transfer_type = 'l'; - *chunk = malloc(length + 2); + *chunk = malloc(length + 2 + 3); + /* Allocating extra 3 bytes prevents false positive valgrind report + * of strlen(chunk) word access: + * Invalid read of size 4 + * Address 0x4479934 is 44 bytes inside a block of size 45 alloc'd */ if (*chunk == NULL) { LOG_ERROR("Unable to allocate memory"); return ERROR_FAIL; |