On 03/19/2015 11:00 AM, Thomas Hurd wrote: > Unconditionally check the magic number before BZ2_bzReadOpen() > instead of only when bzip_blocksize=0, since it falls through. > That way if the file is not compressed it will return immediately > and map_file can mmap it. If the file is compressed then it will > go through the BZ2 functions and any errors will be reported correctly. > > This fixes 0afd5de5c1edb4de2cc5e0e2e2e89551c90534fc so that a bz2 error > isn't reported when a uncompressed pp is installed successfully. Thanks, applied. > > Signed-off-by: Thomas Hurd <thurd@xxxxxxxxxx> > --- > libsemanage/src/direct_api.c | 15 ++++++--------- > 1 file changed, 6 insertions(+), 9 deletions(-) > > diff --git a/libsemanage/src/direct_api.c b/libsemanage/src/direct_api.c > index 5922fcc..e4f168e 100644 > --- a/libsemanage/src/direct_api.c > +++ b/libsemanage/src/direct_api.c > @@ -445,16 +445,13 @@ ssize_t bunzip(semanage_handle_t *sh, FILE *f, char **data) > goto exit; > } > > - if (!sh->conf->bzip_blocksize) { > - bzerror = fread(buf, 1, BZ2_MAGICLEN, f); > - rewind(f); > - if ((bzerror != BZ2_MAGICLEN) || memcmp(buf, BZ2_MAGICSTR, BZ2_MAGICLEN)) { > - ERR(sh, "bz2 magic number not found."); > - goto exit; > - } > - /* fall through */ > + /* Check if the file is bzipped */ > + bzerror = fread(buf, 1, BZ2_MAGICLEN, f); > + rewind(f); > + if ((bzerror != BZ2_MAGICLEN) || memcmp(buf, BZ2_MAGICSTR, BZ2_MAGICLEN)) { > + goto exit; > } > - > + > b = BZ2_bzReadOpen ( &bzerror, f, 0, sh->conf->bzip_small, NULL, 0 ); > if ( bzerror != BZ_OK ) { > ERR(sh, "Failure opening bz2 archive."); > _______________________________________________ Selinux mailing list Selinux@xxxxxxxxxxxxx To unsubscribe, send email to Selinux-leave@xxxxxxxxxxxxx. To get help, send an email containing "help" to Selinux-request@xxxxxxxxxxxxx.