I'm working on a illness thing, and I need to make it so it checks if a player has eaten some rotten flesh then gives the player infinite hunger.
This is really easy with scoreboards. Take a look at my answer for preventing someone from using a diamond sword. The concept is pretty much identical, especially the pre-1.8 method I described. For this reason, I won't go into great detail here.
First, set up a scoreboard objective to track when someone eats rotten flesh:
/scoreboard objectives add AteRottenFlesh stat.useItem.minecraft.rotten_flesh
Next you need two command blocks, one that will induce the hunger, and the other to reset the scoreboard objective:
effect @a[score_AteRottenFlesh_min=1] minecraft:hunger 1000000 1 scoreboard players set @a[score_AteRottenFlesh_min=1] AteRottenFlesh 0
Throw those two commands on a redstone clock, making sure the effect will execute first, and you're basically done.
So you can't actually give a player infinite hunger without constantly reapplying it, which is why I used the max time (one million seconds, or a bit better than 11.5 days) instead. You can set it to always reapply simply by not running the scoreboard command block.
You might want to also want to increase the potency of the hunger (the last number in the effect command). It defaults to 0, I set it to one, but I found that a person's hunger still doesn't go down all that fast. A player can easily keep up with that hunger by eating rotten flesh, but at higher levels, would need steak or lots of cake.