Second borax. We use this on our cloth diapers. It works wonders and you don't need a lot. Completely safe for infant clothes!
Have you done a bleach soak? Stripping shouldn't be necessary if they were cleaned properly, but probably wouldn't hurt on a large secondhand stash. I definitely always sanitize with a bleach soak any secondhand or just when I get my stash back out of storage from a previous baby.
You can indeed use vinegar in your wash
Vinegar!
Try stripping them! You can get RLR off Amazon or use borax and washing power. https://fluffloveuniversity.com/troubleshooting/solving-stinky-diaper-problems/how-to-strip-your-cloth-diapers/