https://bugs.kde.org/show_bug.cgi?id=488026
Bug ID: 488026 Summary: Use of `sizeof` instead of `strlen` Classification: Developer tools Product: valgrind Version: unspecified Platform: Other OS: All Status: REPORTED Severity: minor Priority: NOR Component: general Assignee: jsew...@acm.org Reporter: nith...@hotmail.com Target Milestone: --- Created attachment 170137 --> https://bugs.kde.org/attachment.cgi?id=170137&action=edit Patch fixing the aforementioned bug. SUMMARY On commit `faa8c5274`, in `coregrind/m_initimg/initimg-linux.c`, in `setup_client_env`, line 146/147 read: Int preload_core_path_len = vglib_len + sizeof(preload_core) + sizeof(VG_PLATFORM) + 16; For context, the definition of `preload_core` is line 128: const HChar* preload_core = "vgpreload_core"; The `sizeof(preload_core)` on line 146 evaluates the size of a pointer rather than the string behind it (unlike for `VG_PLATFORM` which is a macro). Lines 146/147 should be: Int preload_core_path_len = vglib_len + VG_(strlen)(preload_core) + sizeof(VG_PLATFORM) + 16; This code currently works thanks to the two `+ 16` which make up for the mismatch between the size of the pointer and the length of the name. Patch is attached. STEPS TO REPRODUCE N/A OBSERVED RESULT N/A EXPECTED RESULT N/A SOFTWARE/OS VERSIONS Linux: Linux 6.9.3-arch1-1 #1 SMP PREEMPT_DYNAMIC Fri, 31 May 2024 15:14:45 +0000 x86_64 GNU/Linux ADDITIONAL INFORMATION I have attempted submitting the patch on Gitlab but failed to find the repository. -- You are receiving this mail because: You are watching all bug changes.