On my phone it looks like the beginning of dry rot. I would use a flat blade screw driver and press where you think it is the worst if the blade doesn't sink in the wood is ok, double. Double check with the same pressure in an area that looks clean.
I think you will find the wood is ok but now you want to stop it from getting worse,. I use a 3% hydrogen peroxide solution and water: this will kill the fungus without the smell of bleach, but is tougher to find than than bleach. A dilute solution of chlorine bleach and water that will also work,work; being in the attic the smell may not be a problem in the living space if the roof is well ventilated.
If you do use hydrogen peroxide remember to add it to the water rather than the other way around ( AAA. /AlwaysAAA=Always Add Acid).