Fix dereferencing of cackey_pin_command when it is NULL and ensure printed buffers are truncated