Don't panic; surprises happen in remodeling. Unless necessary, don't rip out the entire stud. Doing so may cause more problems with surrounding structural elements. Instead, sister it.
Sistering is the process of repairing a deteriorated stud by nailing, screwing, or bolting a similar piece of material next to it. Per building code in most localities, the sistering method is not allowed for load-bearing walls.
Tip: Find Out How to Remove/Replace an Interior Load-Bearing Wall
The new piece of material does not have to be as long as the deteriorated section. But of course--the longer, the better. Make sure it extends well beyond the deteriorated area--in both directions. Be sure the deteriorated stud has enough solid material to which you can attach the new material.
Note: Also, make certain that this sistering job is not symptomatic of some larger problem--termites, water incursion, pervasive rotting wood, etc. You don't want to be putting a Band-Aid on the problem.

