Fixes heap-based buffer overflow in the encode_msg function. Signed-off-by: Sebastian Kemper <sebastian_ml@gmx.net>