]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
coregrind: fix allocation length
authorEthiraric <ethiraric@gmail.com>
Tue, 4 Jun 2024 16:37:48 +0000 (18:37 +0200)
committerPaul Floyd <pjfloyd@wanadoo.fr>
Wed, 5 Jun 2024 06:00:14 +0000 (08:00 +0200)
The `sizeof(preload_core)` here evaluates the size of a pointer rather
than the string behind it (unlike for `VG_PLATFORM` which is a
macro).

coregrind/m_initimg/initimg-linux.c

index c2101b15f11a4f38234a7c81add6af9007370d66..5359189bf69181f8f22317c1a7ac9d5a8b6b5988 100644 (file)
@@ -143,7 +143,7 @@ static HChar** setup_client_env ( HChar** origenv, const HChar* toolname, Bool u
       paths.  We might not need the space for vgpreload_<tool>.so, but it
       doesn't hurt to over-allocate briefly.  The 16s are just cautious
       slop. */
-   Int preload_core_path_len = vglib_len + sizeof(preload_core) 
+   Int preload_core_path_len = vglib_len + VG_(strlen)(preload_core)
                                          + sizeof(VG_PLATFORM) + 16;
    Int preload_tool_path_len = vglib_len + VG_(strlen)(toolname) 
                                          + sizeof(VG_PLATFORM) + 16;