Finding out the exact ingredients of medicines and knowing the list of all thousands of banned substances requires requires specialist knowledge and analysis. If you need a medicine due to sickness on short notice it is extremely hard to know for sure that there isn't a banned substance in it unless it's a known-safe medication.
However, unless he was suffering from a severe case of migraine (who usually requires IV drugs, therefore, requiring a physician to prescribe the drug), odds are that his judgement was preserved and he could had made the smart decision of asking a doctor (if I am not mistaken, most tournaments have local doctors working) about which medication he could take. I mean: if a headache is severe enough for the pain cloud your judgement, it wont probably subside by oral medication.
We are talking about athletes. It is sort of part of their job description knowing that they cant take any medication without caring about doping. I just dont buy this "I didnt know" excuse. To the very least, it is lack of professionalism.