More security fixes for capabilities

This patch fixes a security issue which would allow an attackant to set bytes to 1 at choosen places.
It also fixes a warning when DEBUG_CAPABILITIES is set.
Merge pull request #1640 from hardening/capafix2

More security fixes for capabilities
Fix CVE-2014-0791

This patch fixes CVE-2014-0791, the remaining length in the stream is checked
before doing some malloc().
Merge pull request #1656 from hardening/CVE-2014-0791-v2

Fix CVE-2014-0791