Correcting errors and erasures via the syndrome variety