git-svn: trunk@3488
Tomasz Kojm authored on 2008/01/09 20:58:02... | ... |
@@ -1,3 +1,7 @@ |
1 |
+Wed Jan 9 12:29:48 CET 2008 (tk) |
|
2 |
+--------------------------------- |
|
3 |
+ * libclamav/cvd.c: gzdopen() may not close fd |
|
4 |
+ |
|
1 | 5 |
Wed Jan 9 11:13:25 CET 2008 (tk) |
2 | 6 |
--------------------------------- |
3 | 7 |
* libclamav/cvd.c: fix error path descriptor leak (reported by G. Tiesi) |
... | ... |
@@ -51,6 +51,7 @@ int cli_untgz(int fd, const char *destdir) |
51 | 51 |
int nbytes, nread, nwritten, in_block = 0, fdd; |
52 | 52 |
unsigned int size, pathlen = strlen(destdir) + 100 + 5; |
53 | 53 |
FILE *outfile = NULL; |
54 |
+ struct stat foo; |
|
54 | 55 |
gzFile *infile; |
55 | 56 |
|
56 | 57 |
|
... | ... |
@@ -63,6 +64,8 @@ int cli_untgz(int fd, const char *destdir) |
63 | 63 |
|
64 | 64 |
if((infile = gzdopen(fdd, "rb")) == NULL) { |
65 | 65 |
cli_errmsg("cli_untgz: Can't gzdopen() descriptor %d, errno = %d\n", fdd, errno); |
66 |
+ if(fstat(fdd, &foo) == 0) |
|
67 |
+ close(fdd); |
|
66 | 68 |
return -1; |
67 | 69 |
} |
68 | 70 |
|