It's what is best for the mom and child.
I was hospitalized when my son was 6 months old, and couldn't get the milk back after that - I was very sad to have to stop early. Of my two children, he is more prone to allergies.
About 12 months is recommended, but it's difficult to wean a child at that time if they are used to the mother/child time. There are benefits to this that go beyond nourishment.
After this point, I think the child naturally detaches a bit by 18 months, still wanting to be close with the mother, but also more interesting in the world beyond her lap - this is a pretty good time to wean.
But to your question about how long is TOO long - I generally respect any mother to make this decision for herself. It does get harder to wean after the child no longer needs the breast-milk, but will breast feed for comfort or habit.
Most often the decision is made when breast-feeding becomes inconvenient - the child can 'ask' for it in public, or won't go to sleep without it (which can affect the mom's 'time' to herself at the end of the day, etc), or a sibling is born.