Skip to content

util: Fix GCC 12 format-overflow error.

Vinson Lee requested to merge vlee/mesa:util-fix-gcc12-error into main
../src/util/tests/hash_table/collision.c: In function ‘main’:
../src/util/tests/hash_table/collision.c:91:25: error: ‘%d’ directive writing between 1 and 11 bytes into a region of size 6 [-Werror=format-overflow=]
   91 |       sprintf(key, "spam%d", i);
      |                         ^~
../src/util/tests/hash_table/collision.c:91:20: note: directive argument in the range [-2147483647, 99]
   91 |       sprintf(key, "spam%d", i);
      |                    ^~~~~~~~
../src/util/tests/hash_table/collision.c:91:7: note: ‘sprintf’ output between 6 and 16 bytes into a destination of size 10
   91 |       sprintf(key, "spam%d", i);
      |       ^~~~~~~~~~~~~~~~~~~~~~~~~

Signed-off-by: Vinson Lee <vlee@freedesktop.org>

Edited by Matt Turner

Merge request reports