cpio: Check header magic number

Add CPIO header magic number checking to fail fast if there's something
wrong with the CPIO format.

Found by code inspection.

Reviewed-by: Glauber Costa <glommer@cloudius-systems.com>
Cc: Benoît Canet <benoit@irqsave.net>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>
cpio: Fix zero-length files

If c_filesize is zero, bail out immediately from parse_one(). Otherwise
the rdbuf()->pubsetbuf() call will wreak havoc on the stream position
and cause the next header to have corrupt CPIO magic.

Found by streaming openjdk rpm2cpio output to OSv.

Reviewed-by: Glauber Costa <glommer@cloudius-systems.com>
Cc: Benoît Canet <benoit@irqsave.net>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>