lib/worker: Account for offset and delimiter when sending logmessages

A check is in place to make sure we don't overflow the buffer or
read past the end of it, but the check didn't account for the fact
that we print to offset 4 of the buffer, and then need an additional
3 bytes for the message delimiter. This patch takes care of those
last two brainfarts.

Signed-off-by: Andreas Ericsson <ae@op5.se>
lib/nsock: Make nsock_printf{_nul}() mimic printf() properly

They were always intended to, but since they were backed by a function
using a static size buffer, we could never print more than 4096 bytes
in a single printf(). This patch amends that, and although it will
be slightly slower to use the generic function, we now know we'll
never run into buffer overflows when adding the terminating nul-byte.
Failures will only ever happen when we fail to allocate memory, in
which case the call is scrapped in its entirety.

In exceptional circumstances, this could otherwise lead to information
leaks if modules use the nsock_printf() functions to send information
to listeners that exceeded 4096 bytes per write.

Discovered-by: Aman Gupta <aman@tmm1.net>
Reported-by: Dirkjan Bussink <dirkjan.bussink@github.com>
Thanks-to: Markus Frosch <markus@lazyfrosch.de>
Signed-off-by: Andreas Ericsson <ae@op5.se>