util: fix gcc vsnprintf overflow
authorMichel Zou <xantares09@hotmail.com>
Thu, 18 Feb 2021 16:20:22 +0000 (17:20 +0100)
committerMarge Bot <eric+marge@anholt.net>
Fri, 19 Feb 2021 11:05:38 +0000 (11:05 +0000)
commit34d6ce28e380d48c8c42a6b52a9c39abba8d341a
tree505386fa14e5d5d1c421b8b2a72c1cef1a4a24c6
parentb6b3b38434a87b21eb8811baca7f6244d24e33aa
util: fix gcc vsnprintf overflow

Anything higher than INT_MAX results in overflow although the parameter is declared as size_t.

Worse, with (size_t)-1 it is silently ignored and Woverflow is not emitted.

Closes #4226

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
Tested-by: Prodea Alexandru-Liviu <liviuprodea@yahoo.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9134>
src/util/u_string.h