Id get it from the vet. You`ll prob need to get a poopy sample so they will know what kind of wormer to give him. Over the counter typs are pretty genaric and can make the cat sick..and still have worms.
The vet would have to check your cat. You don't need to give her just any old kind of worm medicine. There are different kinds of worms and the medicine would depend on what kind, if any worms your cat has. Don't do the otc stuff.