util: fix possible buffer overflow in util_get_process_exec_path
[mesa.git] / src / util / u_process.c
index 74c4d10192ef34eb7a388ff9b7e583ef66d1038e..68fda93a53bb22515fb5c04f64d85534d8640df7 100644 (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;