Apply upstream security patch https://github.com/civicrm/civicrm-core/pull/1708.diff

Change-Id: Ic26a7dfa9a8ef4121d11b26a74ac0e1a76eecb5c