Within certain conditions a sword can pose a threat against a firearm, but not beyond it’s length. There’s a reason it’s not used anymore.
A sword is not exactly CQC. Also, you don’t really have to aim accurately from that close, it’s enough to hit somewhere, where it hurts.
It still doesn’t do much if the guy with the sword is slow and predictable, and someone without training is that probably.
Edit, obligatory: http://www.youtube.com/watch?v=3I_Ds2ytz4o