diff options
author | Richard Hughes <richard@hughsie.com> | 2015-08-25 19:37:47 +0100 |
---|---|---|
committer | Richard Hughes <richard@hughsie.com> | 2015-08-25 21:08:18 +0100 |
commit | ead459a6132d069ed742252eab2cb800a03d0bde (patch) | |
tree | 9ec929357340d84e81ff2678d9de3cd019cdd61f | |
parent | e48074952743f53d8ac529d4debc421e7e0f6937 (diff) | |
download | gcab-ead459a6132d069ed742252eab2cb800a03d0bde.tar.gz |
Do not abort with a critical warning if a file has an incorrect checksum
-rw-r--r-- | libgcab/cabinet.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/libgcab/cabinet.c b/libgcab/cabinet.c index 1fcd36a..1fa2af8 100644 --- a/libgcab/cabinet.c +++ b/libgcab/cabinet.c @@ -477,7 +477,11 @@ cdata_read (cdata_t *cd, u1 res_data, gint comptype, RN (buf, cd->ncbytes); datacsum = compute_checksum(buf, cd->ncbytes, 0); - g_return_val_if_fail (cd->checksum == compute_checksum ((guint8*)&cd->ncbytes, 4, datacsum), FALSE); + if (cd->checksum != compute_checksum ((guint8*)&cd->ncbytes, 4, datacsum)) { + g_set_error_literal (error, GCAB_ERROR, GCAB_ERROR_FAILED, + _("incorrect checksum detected")); + return FALSE; + } if (g_getenv ("GCAB_DEBUG")) { g_debug ("CDATA"); |