Fix possible realloc overflow for gpgsm and uiserver engines.