apparmor: reset pos on failure to unpack for various functions

Each function that manipulates the aa_ext struct should reset it's "pos"
member on failure. This ensures that, on failure, no changes are made to
the state of the aa_ext struct.

A bug was found in unpack_u32(), unpack_u64(), unpack_array(), and
unpack_blob() where if the call to inbounds() fails, the pos member of
the aa_ext struct is not reset. All of the aforementioned functions have
been updated so that on failure the pos member of the aa_ext struct is
reset.

Signed-off-by: Mike Salvatore <mike.salvatore@canonical.com>
Acked-by: Eric Chiang <ericchiang@google.com>
1 file changed