fix malloc bugs, when the ciphertext is a bit long, there may be a malloc error, now fix it