On M5mm bolt it should be perfect, as the nut is smaller too. And on a ring terminal for 5mm bolt there should be no problem. The next size is 10 or 12mm. But bolts are cheap. So order a few different lengths if your ring terminals are thicker metal. Or order 10mm long. Or measure yours... The nut is 1.5 x the 5mm (so 7mm tall) The bolt is 8mm long... So 1mm left for the ring... Order 10mm. If you can find any. Or 12mm but there will be 2 or 3mm sticking out extra.
https://www.westfieldfasteners.co.uk/Da ... High_M.pdfLooking at this, then ideally you will need 10mm for a nyloc nut inc fuse/ring.
Or 8mm for nornal nut including ring and fuse.
But I dont think 10mm is easy to get. So you have a choice of 8mm (normal nut) or 12mm which is a little longer than needed, for nyloc.
So probably better to use normal M5 nut and a dab of loctite, and 8mm long bolt. Because that keeps it all thinner and neater easy to heatshrink.