util: fix possible buffer overflow in util_get_process_exec_path

Found by Coverity.

Signed-off-by: Marcin Ślusarz <marcin.slusarz@intel.com>
Fixes: f8f1413070 ("util/u_process: add util_get_process_exec_path")
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6067>
This commit is contained in:
Marcin Ślusarz 2020-07-24 18:14:24 +02:00 committed by Marge Bot
parent 59bb0ff945
commit f13042ec7e

View file

@ -187,6 +187,9 @@ util_get_process_exec_path(char* process_path, size_t len)
return 0;
success:
if (r == len)
return 0;
process_path[r] = '\0';
return r;