Is there any risk in joining a minecraft public server?
Solution 1:
You should try to play only on servers you can trust, which are mostly the big and famous ones. You can find a list of them here.
As said in the comments though, and as always on the internet, be wary of what you share with others, avoid at all costs sharing your password, IP address and such with anyone you don't know and trust.