Skip to content

Commit

Permalink
Merge pull request #725 from dannlee/fix-get-exec-name-readlink-length
Browse files Browse the repository at this point in the history
Ensure readlink uses correct buffer size in get_exec_name
  • Loading branch information
lti9hc authored Jan 8, 2025
2 parents 80371aa + d3fe5c0 commit 880b98b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/core_dump_handler/dlt_cdh_context.c
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ cdh_status_t get_exec_name(unsigned int p_pid, char *p_exec_name, int p_exec_nam
memset(l_exe_link, 0, sizeof(l_exe_link));
snprintf(l_exe_link, sizeof(l_exe_link) - 1, "/proc/%d/exe", p_pid);

if (readlink(l_exe_link, g_buffer, p_exec_name_maxsize) < 0)
if (readlink(l_exe_link, g_buffer, sizeof(g_buffer) - 1) < 0)
return CDH_NOK;

if ((l_name_ptr = strrchr(g_buffer, '/')) == NULL)
Expand Down

0 comments on commit 880b98b

Please sign in to comment.