First apply SUPEE-1533 patch then SUPEE-5344. Also check if you have overridden Http.php file at following location app/code/local/Mage/Core/Controller/Response/Http.php then you have to add following method to the Http.php file
/**
* Method send already collected headers and exit from script
*/
public function sendHeadersAndExit()
{
$this->sendHeaders();
exit;
}