commit 3d4d014: [Fix] Archive: Final fixes for 7z archives
Vsevolod Stakhov
vsevolod at highsecure.ru
Fri Jan 11 15:35:09 UTC 2019
Author: Vsevolod Stakhov
Date: 2019-01-11 15:24:47 +0000
URL: https://github.com/rspamd/rspamd/commit/3d4d0144a5bac2ece3d3b7e0c25519b0b3ea9798 (HEAD -> master)
[Fix] Archive: Final fixes for 7z archives
Issue: #2629
Closes: #2629
---
src/libmime/archives.c | 15 +++++----------
1 file changed, 5 insertions(+), 10 deletions(-)
diff --git a/src/libmime/archives.c b/src/libmime/archives.c
index 34c529a64..56e880577 100644
--- a/src/libmime/archives.c
+++ b/src/libmime/archives.c
@@ -809,7 +809,7 @@ rspamd_archive_7zip_read_vint (const guchar *start, gsize remain, guint64 *res)
p += sizeof (guint64); \
} while (0)
#define SZ_SKIP_BYTES(n) do { \
- if (end - p > (n)) { \
+ if (end - p >= (n)) { \
p += (n); \
} \
else { \
@@ -1463,10 +1463,7 @@ rspamd_7zip_read_files_info (struct rspamd_task *task,
case kATime:
case kMTime:
/* We don't care of these guys, but we still have to parse them, gah */
- if (sz == 0) {
- goto end;
- }
- else {
+ if (sz > 0) {
SZ_SKIP_BYTES (sz);
}
break;
@@ -1507,9 +1504,10 @@ rspamd_7zip_read_files_info (struct rspamd_task *task,
res = rspamd_7zip_ucs2_to_utf8 (task, p, fend);
if (res != NULL) {
- fentry = g_malloc0 (sizeof (fentry));
+ fentry = g_malloc0 (sizeof (*fentry));
fentry->fname = res;
g_ptr_array_add (arch->files, fentry);
+ msg_debug_archive ("7zip: found file %v", res);
}
else {
msg_debug_archive ("bad 7zip name; %s", G_STRLOC);
@@ -1521,10 +1519,7 @@ rspamd_7zip_read_files_info (struct rspamd_task *task,
break;
case kDummy:
case kWinAttributes:
- if (sz == 0) {
- goto end;
- }
- else {
+ if (sz > 0) {
SZ_SKIP_BYTES (sz);
}
break;
More information about the Commits
mailing list