Fix CVE 2013-4495. Note: this patch has been verified as fixing this security hole but has not received other regression testing.