I Have used some M12 X 40 set bolts for my diff mounting brackets ( All I could find in the workshop ) , to be honest, they look a little bit over the top for the job
I would imagine that M12 X 30's would be ideal
Noticed that you have gone for 40's, like you say, not a problem to trim them to the ideal length