daemon/network: fix heap-buffer-overflow in endpoint key generation
Reproducible by listening on an interface by name, ASAN reports a heap-buffer-overflow. This was a regression caused by !1286 (merged), which did not account for null-terminators properly.