From 7de0996a1cd8351cb9bc8b4a4aa1adde3c162f56f25a1729f4b9f51c8114a423 Mon Sep 17 00:00:00 2001 From: Marcus Meissner Date: Thu, 31 May 2012 12:00:13 +0000 Subject: [PATCH] x OBS-URL: https://build.opensuse.org/package/show/security/tboot?expand=0&rev=15 --- zlib.patch | 53 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) diff --git a/zlib.patch b/zlib.patch index 306aa88..9cd3cd4 100644 --- a/zlib.patch +++ b/zlib.patch @@ -13,3 +13,56 @@ Index: tboot-1.7.0/lcptools/mlehash.c struct stat filestat; char tmpbuffer[1024]; unsigned long i; +Index: tboot-1.7.0/tb_polgen/commands.c +=================================================================== +--- tboot-1.7.0.orig/tb_polgen/commands.c ++++ tboot-1.7.0/tb_polgen/commands.c +@@ -54,26 +54,31 @@ extern tb_policy_t *g_policy; + static bool hash_file(const char *filename, bool unzip, tb_hash_t *hash) + { + FILE *f; ++ gzFile gf; + static char buf[1024]; + EVP_MD_CTX ctx; + const EVP_MD *md; + int read_cnt; + +- if ( unzip ) +- f = gzopen(filename, "rb"); +- else ++ if ( unzip ) { ++ gf = gzopen(filename, "rb"); ++ if ( gf == NULL ) { ++ error_msg("File %s does not exist\n", filename); ++ return false; ++ } ++ } else { + f = fopen(filename, "rb"); +- +- if ( f == NULL ) { +- error_msg("File %s does not exist\n", filename); +- return false; ++ if ( f == NULL ) { ++ error_msg("File %s does not exist\n", filename); ++ return false; ++ } + } + + md = EVP_sha1(); + EVP_DigestInit(&ctx, md); + do { + if ( unzip ) +- read_cnt = gzread(f, buf, sizeof(buf)); ++ read_cnt = gzread(gf, buf, sizeof(buf)); + else + read_cnt = fread(buf, 1, sizeof(buf), f); + if ( read_cnt == 0 ) +@@ -84,7 +89,7 @@ static bool hash_file(const char *filena + EVP_DigestFinal(&ctx, hash->sha1, NULL); + + if ( unzip ) +- gzclose(f); ++ gzclose(gf); + else + fclose(f); +