Madeira cake and wine are extremely long-lasting, so you can safely bring some back.
It's safe to bring home Madeira cake or wine because they preserve very well.
Neither Madeira cake nor wine will make it past airport security.