fix potential buffer overflow
be sure content sent to daemon is complete