My understanding of it is that if where you're leaving from is legal and where you're going to is legal it's ok the transport thru other strict or ban states. This is federal law.
So, you're driving thru NY, what's the final destination? If say VT, NH or Maine, and you've a state permit from your state for carry purposes, then those states are Constitutional carry so it's a non issue. If NY, Ct or Mass its no good. At least for handguns and banned firearms per those states. If bringing standard sporting shotguns, hunting rifles it shouldn't be a problem.
I've traveled thru those areas with the firearm locked in a separate case and the ammo in another. Mass law requires it so that's what I've done. I believe the law allows for a stop as long as it's not a visit. Like gas, food, that kind of thing. I personally wouldn't stay overnight in traveling thru a state that is strict as it's turning more into a visit.
Also many strict states have permits required for ammo purchases, so don't forget to bring ammo with you.
Laws change at various times, some of what I listed could be dated, so best to check federal and state laws where you can.
HTH