git-svn: trunk@4137
Tomasz Kojm authored on 2008/08/25 06:56:16... | ... |
@@ -1,3 +1,8 @@ |
1 |
+Sun Aug 24 23:51:48 CEST 2008 (tk) |
|
2 |
+---------------------------------- |
|
3 |
+ * libclamav/unrar.c: improve handling of currupted archives and downgrade |
|
4 |
+ some error messages |
|
5 |
+ |
|
1 | 6 |
Sat Aug 23 22:18:47 CEST 2008 (tk) |
2 | 7 |
---------------------------------- |
3 | 8 |
* shared/misc.c: fix double "-exp" |
... | ... |
@@ -89,7 +89,6 @@ cli_untar(const char *dir, int desc, unsigned int posix, cli_ctx *ctx) |
89 | 89 |
char magic[7], name[101], osize[13]; |
90 | 90 |
|
91 | 91 |
if(fout>=0) { |
92 |
- int ret; |
|
93 | 92 |
lseek(fout, 0, SEEK_SET); |
94 | 93 |
ret = cli_magic_scandesc(fout, ctx); |
95 | 94 |
close(fout); |
... | ... |
@@ -110,7 +109,7 @@ cli_untar(const char *dir, int desc, unsigned int posix, cli_ctx *ctx) |
110 | 110 |
strncpy(magic, block+257, 5); |
111 | 111 |
magic[5] = '\0'; |
112 | 112 |
if(strcmp(magic, "ustar") != 0) { |
113 |
- cli_dbgmsg("Incorrect magic string '%s' in tar header\n", magic); |
|
113 |
+ cli_dbgmsg("cli_untar: Incorrect magic string '%s' in tar header\n", magic); |
|
114 | 114 |
return CL_EFORMAT; |
115 | 115 |
} |
116 | 116 |
} |
... | ... |
@@ -119,7 +118,7 @@ cli_untar(const char *dir, int desc, unsigned int posix, cli_ctx *ctx) |
119 | 119 |
|
120 | 120 |
switch(type) { |
121 | 121 |
default: |
122 |
- cli_warnmsg("cli_untar: unknown type flag %c\n", type); |
|
122 |
+ cli_dbgmsg("cli_untar: unknown type flag %c\n", type); |
|
123 | 123 |
case '0': /* plain file */ |
124 | 124 |
case '\0': /* plain file */ |
125 | 125 |
case '7': /* contiguous file */ |
... | ... |
@@ -163,14 +162,12 @@ cli_untar(const char *dir, int desc, unsigned int posix, cli_ctx *ctx) |
163 | 163 |
osize[12] = '\0'; |
164 | 164 |
size = octal(osize); |
165 | 165 |
if(size < 0) { |
166 |
- cli_errmsg("Invalid size in tar header\n"); |
|
167 |
- if(fout>=0) |
|
168 |
- close(fout); |
|
169 |
- return CL_CLEAN; |
|
170 |
- } |
|
171 |
- cli_dbgmsg("cli_untar: size = %d\n", size); |
|
172 |
- if((ret=cli_checklimits("cli_untar", ctx, size, 0, 0))!=CL_CLEAN) { |
|
166 |
+ cli_dbgmsg("cli_untar: Invalid size in tar header\n"); |
|
173 | 167 |
skipEntry++; |
168 |
+ } else { |
|
169 |
+ cli_dbgmsg("cli_untar: size = %d\n", size); |
|
170 |
+ if((ret=cli_checklimits("cli_untar", ctx, size, 0, 0))!=CL_CLEAN) |
|
171 |
+ skipEntry++; |
|
174 | 172 |
} |
175 | 173 |
|
176 | 174 |
if(skipEntry) { |
... | ... |
@@ -188,7 +185,7 @@ cli_untar(const char *dir, int desc, unsigned int posix, cli_ctx *ctx) |
188 | 188 |
fout = open(fullname, O_RDWR|O_CREAT|O_EXCL|O_TRUNC|O_BINARY, 0600); |
189 | 189 |
|
190 | 190 |
if(fout < 0) { |
191 |
- cli_errmsg("Can't create temporary file %s: %s\n", fullname, strerror(errno)); |
|
191 |
+ cli_errmsg("cli_untar: Can't create temporary file %s: %s\n", fullname, strerror(errno)); |
|
192 | 192 |
return CL_ETMPFILE; |
193 | 193 |
} |
194 | 194 |
|
... | ... |
@@ -211,7 +208,6 @@ cli_untar(const char *dir, int desc, unsigned int posix, cli_ctx *ctx) |
211 | 211 |
in_block = 0; |
212 | 212 |
} |
213 | 213 |
if(fout>=0) { |
214 |
- int ret; |
|
215 | 214 |
lseek(fout, 0, SEEK_SET); |
216 | 215 |
ret = cli_magic_scandesc(fout, ctx); |
217 | 216 |
close(fout); |