Fix undefined behaviour triggered by test suite
for_each_helper and wl_socket_init_for_display_name both have undefined behaviour on some inputs
Notably this was not picked up by !139 turning on ubsan and asan, probably because the CI container is using gcc while I am using clang. Neither of these issues were picked up by GCC 10.
With this the test suite is ubsan-clean with clang 11.