First of all well done you for getting him back
Just get him to the vets asap, he looks like he could do with some anti biotics, the only way a dog gets them (kennal sores) is by sleeping on bare boards or concrete.
SUDOCREME in a grey plastic jar that you get for babies bums is a great cream to use you can get it in chemists and its not very expensive and is used for bed sores as well in humans which is a similar thing
Good luck with him