VERY common problem with a lot of YJs. I'm not usually one to simply suggest searching the forum for "YJ frame repair", but there are so many threads on this subject that linking them here could fill a page and still only cover 5% of those available for reading.
If the frame isn't so far gone as a couple mentioned above, there are two main options, use a frame repair kit or pre-fabbed section from vendors like Auto Rust Technicians or salvaged frame section from someone like Davey's Jeeps, or fabricate your own using plate or rectangle stock.
Just an FYI, if you have bad rot in those two locations, I'd also look carefully at the cross member just in front of the fuel tank (2 body mounts there too), behind the fuel filter, and around the steering box mount. All areas as notorious for frame rot as those in which you've already located a problem.
Post up some pics like the other said, lots of great help here from some terrific fabricators!