Your slab is 4", your foundation walls are what...8" or 10" thick?
You should be fine nailing the studs off on the concrete walls. It's done quite often. If you're truly worried, screw them in with Tapcon screws. Without a doubt, Tapcons are the best for screwing into concrete.
Any framing lumber that will be in direct contact with sub-grade concrete (basement walls, slab, etc) should be pressure treated.