From: Marcin Ślusarz Date: Fri, 24 Jul 2020 16:14:24 +0000 (+0200) Subject: util: fix possible buffer overflow in util_get_process_exec_path X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=f13042ec7ea6842cbee81590f40b0e5c2e25a9bf;p=mesa.git util: fix possible buffer overflow in util_get_process_exec_path Found by Coverity. Signed-off-by: Marcin Ślusarz Fixes: f8f1413070a ("util/u_process: add util_get_process_exec_path") Reviewed-by: Marek Olšák Part-of: --- diff --git a/src/util/u_process.c b/src/util/u_process.c index 74c4d10192e..68fda93a53b 100644 --- a/src/util/u_process.c +++ b/src/util/u_process.c @@ -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;