|
From: <sv...@va...> - 2014-03-19 11:58:52
|
Author: dejanj
Date: Wed Mar 19 11:58:35 2014
New Revision: 13880
Log:
VG_(strlen) ( const HChar* str ) does not count the null terminator '\0' at the
end of the string, so we need to add an extra element in string 's' for the null
terminator.
VG_(strcpy) ( HChar* dest, const HChar* src ) function copies the string pointed
to by src, including the null terminator ('\0'), to the buffer pointed to by dest.
Modified:
trunk/callgrind/main.c
trunk/massif/ms_main.c
trunk/memcheck/mc_main.c
Modified: trunk/callgrind/main.c
==============================================================================
--- trunk/callgrind/main.c (original)
+++ trunk/callgrind/main.c Wed Mar 19 11:58:35 2014
@@ -1579,7 +1579,7 @@
static Bool handle_gdb_monitor_command (ThreadId tid, const HChar *req)
{
HChar* wcmd;
- HChar s[VG_(strlen(req))]; /* copy for strtok_r */
+ HChar s[VG_(strlen(req)) + 1]; /* copy for strtok_r */
HChar *ssaveptr;
VG_(strcpy) (s, req);
Modified: trunk/massif/ms_main.c
==============================================================================
--- trunk/massif/ms_main.c (original)
+++ trunk/massif/ms_main.c Wed Mar 19 11:58:35 2014
@@ -2389,7 +2389,7 @@
static Bool handle_gdb_monitor_command (ThreadId tid, HChar *req)
{
HChar* wcmd;
- HChar s[VG_(strlen(req))]; /* copy for strtok_r */
+ HChar s[VG_(strlen(req)) + 1]; /* copy for strtok_r */
HChar *ssaveptr;
VG_(strcpy) (s, req);
Modified: trunk/memcheck/mc_main.c
==============================================================================
--- trunk/memcheck/mc_main.c (original)
+++ trunk/memcheck/mc_main.c Wed Mar 19 11:58:35 2014
@@ -5410,7 +5410,7 @@
static Bool handle_gdb_monitor_command (ThreadId tid, HChar *req)
{
HChar* wcmd;
- HChar s[VG_(strlen(req))]; /* copy for strtok_r */
+ HChar s[VG_(strlen(req)) + 1]; /* copy for strtok_r */
HChar *ssaveptr;
VG_(strcpy) (s, req);
|