mirror of
https://github.com/Cisco-Talos/clamav.git
synced 2025-10-19 10:23:17 +00:00
bb#384 - unlink
git-svn: trunk@3747
This commit is contained in:
parent
44fd90eb99
commit
c0a95e0ce6
14 changed files with 72 additions and 58 deletions
|
@ -1,3 +1,7 @@
|
|||
Wed Apr 2 12:30:06 CEST 2008 (acab)
|
||||
------------------------------------
|
||||
* libclamav: check return codes from syscalls (bb#384) - unlink
|
||||
|
||||
Thu Mar 27 20:16:07 EET 2008 (edwin)
|
||||
------------------------------------
|
||||
* test: add test file for RTF (bb #902)
|
||||
|
|
|
@ -374,11 +374,11 @@ static int ea05(int desc, cli_ctx *ctx, char *tmpd) {
|
|||
lseek(i, 0, SEEK_SET);
|
||||
if(cli_magic_scandesc(i, ctx) == CL_VIRUS) {
|
||||
close(i);
|
||||
if(!cli_leavetemps_flag) unlink(tempfile);
|
||||
if(!cli_leavetemps_flag) cli_unlink(tempfile);
|
||||
return CL_VIRUS;
|
||||
}
|
||||
close(i);
|
||||
if(!cli_leavetemps_flag) unlink(tempfile);
|
||||
if(!cli_leavetemps_flag) cli_unlink(tempfile);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
@ -882,11 +882,11 @@ static int ea06(int desc, cli_ctx *ctx, char *tmpd) {
|
|||
lseek(i, 0, SEEK_SET);
|
||||
if(cli_magic_scandesc(i, ctx) == CL_VIRUS) {
|
||||
close(i);
|
||||
if(!cli_leavetemps_flag) unlink(tempfile);
|
||||
if(!cli_leavetemps_flag) cli_unlink(tempfile);
|
||||
return CL_VIRUS;
|
||||
}
|
||||
close(i);
|
||||
if(!cli_leavetemps_flag) unlink(tempfile);
|
||||
if(!cli_leavetemps_flag) cli_unlink(tempfile);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
|
|
@ -437,7 +437,7 @@ fileblobDestructiveDestroy(fileblob *fb)
|
|||
if(fb->fp && fb->fullname) {
|
||||
fclose(fb->fp);
|
||||
cli_dbgmsg("fileblobDestructiveDestroy: %s\n", fb->fullname);
|
||||
if(unlink(fb->fullname) < 0)
|
||||
if(cli_unlink(fb->fullname) < 0)
|
||||
cli_warnmsg("fileblobDestructiveDestroy: Can't delete file %s\n", fb->fullname);
|
||||
free(fb->fullname);
|
||||
fb->fp = NULL;
|
||||
|
@ -466,7 +466,7 @@ fileblobDestroy(fileblob *fb)
|
|||
cli_dbgmsg("fileblobDestroy: %s\n", fb->fullname);
|
||||
if(!fb->isNotEmpty) {
|
||||
cli_dbgmsg("fileblobDestroy: not saving empty file\n");
|
||||
if(unlink(fb->fullname) < 0)
|
||||
if(cli_unlink(fb->fullname) < 0)
|
||||
cli_warnmsg("fileblobDestroy: Can't delete empty file %s\n", fb->fullname);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -765,7 +765,7 @@ static int chm_decompress_stream(int fd, chm_metadata_t *metadata, const char *d
|
|||
lzx_free(stream);
|
||||
|
||||
/* Delete the file */
|
||||
unlink(filename);
|
||||
cli_unlink(filename);
|
||||
retval = tmpfd;
|
||||
|
||||
abort:
|
||||
|
|
|
@ -1240,7 +1240,7 @@ cli_parse_mbox(const char *dir, int desc, cli_ctx *ctx)
|
|||
/* empty message */
|
||||
fclose(fd);
|
||||
#ifdef SAVE_TMP
|
||||
unlink(tmpfilename);
|
||||
cli_unlink(tmpfilename);
|
||||
#endif
|
||||
return CL_CLEAN;
|
||||
}
|
||||
|
@ -1258,7 +1258,7 @@ cli_parse_mbox(const char *dir, int desc, cli_ctx *ctx)
|
|||
#endif
|
||||
fclose(fd);
|
||||
#ifdef SAVE_TMP
|
||||
unlink(tmpfilename);
|
||||
cli_unlink(tmpfilename);
|
||||
#endif
|
||||
return CL_EMEM;
|
||||
}
|
||||
|
@ -1319,7 +1319,7 @@ cli_parse_mbox(const char *dir, int desc, cli_ctx *ctx)
|
|||
signal(SIGSEGV, segv);
|
||||
#endif
|
||||
#ifdef SAVE_TMP
|
||||
unlink(tmpfilename);
|
||||
cli_unlink(tmpfilename);
|
||||
#endif
|
||||
return CL_EMEM;
|
||||
}
|
||||
|
@ -1477,7 +1477,7 @@ cli_parse_mbox(const char *dir, int desc, cli_ctx *ctx)
|
|||
#endif
|
||||
|
||||
#ifdef SAVE_TMP
|
||||
unlink(tmpfilename);
|
||||
cli_unlink(tmpfilename);
|
||||
#endif
|
||||
return retcode;
|
||||
}
|
||||
|
@ -3874,7 +3874,7 @@ rfc1341(message *m, const char *dir)
|
|||
if(stat(fullname, &statb) < 0)
|
||||
continue;
|
||||
if(now - statb.st_mtime > (time_t)(7 * 24 * 3600))
|
||||
if(unlink(fullname) >= 0)
|
||||
if(cli_unlink(fullname) >= 0)
|
||||
cli_dbgmsg("removed old RFC1341 file %s\n", fullname);
|
||||
continue;
|
||||
}
|
||||
|
@ -3883,7 +3883,7 @@ rfc1341(message *m, const char *dir)
|
|||
if(fin == NULL) {
|
||||
cli_errmsg("Can't open '%s' for reading", fullname);
|
||||
fclose(fout);
|
||||
unlink(outname);
|
||||
cli_unlink(outname);
|
||||
free(id);
|
||||
free(number);
|
||||
closedir(dd);
|
||||
|
@ -3906,9 +3906,9 @@ rfc1341(message *m, const char *dir)
|
|||
}
|
||||
fclose(fin);
|
||||
|
||||
/* don't unlink if leave temps */
|
||||
/* don't cli_unlink if leave temps */
|
||||
if(!cli_leavetemps_flag)
|
||||
unlink(fullname);
|
||||
cli_unlink(fullname);
|
||||
break;
|
||||
}
|
||||
rewinddir(dd);
|
||||
|
@ -4411,7 +4411,7 @@ getURL(struct arg *arg)
|
|||
if(location) {
|
||||
char *end;
|
||||
|
||||
unlink(fout);
|
||||
cli_unlink(fout);
|
||||
location += 11;
|
||||
end = location;
|
||||
while(*end && (*end != '\n'))
|
||||
|
|
|
@ -560,6 +560,14 @@ int cli_gentempfd(const char *dir, char **name, int *fd)
|
|||
}
|
||||
#endif
|
||||
|
||||
/* Function: unlink
|
||||
unlink() with error checking
|
||||
*/
|
||||
int cli_unlink(const char *pathname)
|
||||
{
|
||||
if (unlink(pathname)) cli_warnmsg("cli_unlink: failure - %s\n", strerror(errno));
|
||||
}
|
||||
|
||||
#ifdef C_WINDOWS
|
||||
/*
|
||||
* Windows doesn't allow you to delete a directory while it is still open
|
||||
|
@ -585,7 +593,7 @@ cli_rmdirs(const char *name)
|
|||
}
|
||||
|
||||
if(!S_ISDIR(statb.st_mode)) {
|
||||
if(unlink(name) < 0) {
|
||||
if(cli_unlink(name) < 0) {
|
||||
cli_warnmsg("cli_rmdirs: Can't remove %s: %s\n", name, strerror(errno));
|
||||
return -1;
|
||||
}
|
||||
|
@ -697,7 +705,7 @@ int cli_rmdirs(const char *dirname)
|
|||
}
|
||||
}
|
||||
} else
|
||||
if(unlink(path) < 0) {
|
||||
if(cli_unlink(path) < 0) {
|
||||
cli_warnmsg("cli_rmdirs: Couldn't remove %s: %s\n", path, strerror(errno));
|
||||
free(path);
|
||||
closedir(dd);
|
||||
|
@ -809,6 +817,7 @@ int cli_filecopy(const char *src, const char *dest)
|
|||
return close(d);
|
||||
}
|
||||
|
||||
|
||||
/* Implement a generic bitset, trog@clamav.net */
|
||||
|
||||
#define BITS_PER_CHAR (8)
|
||||
|
|
|
@ -234,6 +234,7 @@ int cli_rmdirs(const char *dirname);
|
|||
unsigned char *cli_md5digest(int desc);
|
||||
char *cli_md5stream(FILE *fs, unsigned char *digcpy);
|
||||
char *cli_md5file(const char *filename);
|
||||
int cli_unlink(const char *pathname);
|
||||
int cli_readn(int fd, void *buff, unsigned int count);
|
||||
int cli_writen(int fd, const void *buff, unsigned int count);
|
||||
char *cli_gentemp(const char *dir);
|
||||
|
|
|
@ -393,7 +393,7 @@ cli_pdf(const char *dir, int desc, cli_ctx *ctx)
|
|||
if(streamend <= streamstart) {
|
||||
close(fout);
|
||||
cli_dbgmsg("cli_pdf: Empty stream\n");
|
||||
unlink(fullname);
|
||||
cli_unlink(fullname);
|
||||
continue;
|
||||
}
|
||||
calculated_streamlen = (int)(streamend - streamstart);
|
||||
|
@ -419,7 +419,7 @@ cli_pdf(const char *dir, int desc, cli_ctx *ctx)
|
|||
|
||||
if(ret != CL_CLEAN) {
|
||||
close(fout);
|
||||
unlink(fullname);
|
||||
cli_unlink(fullname);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -427,7 +427,7 @@ cli_pdf(const char *dir, int desc, cli_ctx *ctx)
|
|||
|
||||
if(tmpbuf == NULL) {
|
||||
close(fout);
|
||||
unlink(fullname);
|
||||
cli_unlink(fullname);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -436,7 +436,7 @@ cli_pdf(const char *dir, int desc, cli_ctx *ctx)
|
|||
if(ret == -1) {
|
||||
free(tmpbuf);
|
||||
close(fout);
|
||||
unlink(fullname);
|
||||
cli_unlink(fullname);
|
||||
continue;
|
||||
}
|
||||
if(ret) {
|
||||
|
@ -448,7 +448,7 @@ cli_pdf(const char *dir, int desc, cli_ctx *ctx)
|
|||
if(t == NULL) {
|
||||
free(tmpbuf);
|
||||
close(fout);
|
||||
unlink(fullname);
|
||||
cli_unlink(fullname);
|
||||
continue;
|
||||
}
|
||||
tmpbuf = t;
|
||||
|
@ -490,7 +490,7 @@ cli_pdf(const char *dir, int desc, cli_ctx *ctx)
|
|||
if(tableFind(md5table, md5str) >= 0) {
|
||||
cli_dbgmsg("cli_pdf: not scanning duplicate embedded file '%s'\n", fullname);
|
||||
close(fout);
|
||||
unlink(fullname);
|
||||
cli_unlink(fullname);
|
||||
continue;
|
||||
} else
|
||||
tableInsert(md5table, md5str, 1);
|
||||
|
@ -500,7 +500,7 @@ cli_pdf(const char *dir, int desc, cli_ctx *ctx)
|
|||
rc = cli_magic_scandesc(fout, ctx);
|
||||
}
|
||||
close(fout);
|
||||
if(!cli_leavetemps_flag) unlink(fullname);
|
||||
if(!cli_leavetemps_flag) cli_unlink(fullname);
|
||||
if(rc != CL_CLEAN) break;
|
||||
}
|
||||
|
||||
|
@ -650,7 +650,7 @@ flatedecode(unsigned char *buf, off_t len, int fout, cli_ctx *ctx)
|
|||
}
|
||||
|
||||
#ifdef SAVE_TMP
|
||||
unlink(tmpfilename);
|
||||
cli_unlink(tmpfilename);
|
||||
#endif
|
||||
inflateEnd(&stream);
|
||||
return CL_CLEAN;
|
||||
|
|
|
@ -99,13 +99,13 @@ if((ndesc = open(tempfile, O_RDWR|O_CREAT|O_TRUNC|O_BINARY, S_IRWXU)) < 0) { \
|
|||
return CL_EIO; \
|
||||
}
|
||||
|
||||
#define CLI_TMPUNLK() if(!cli_leavetemps_flag) unlink(tempfile)
|
||||
#define CLI_TMPUNLK() if(!cli_leavetemps_flag) cli_unlink(tempfile)
|
||||
|
||||
#define FSGCASE(NAME,FREESEC) \
|
||||
case 0: /* Unpacked and NOT rebuilt */ \
|
||||
cli_dbgmsg(NAME": Successfully decompressed\n"); \
|
||||
close(ndesc); \
|
||||
unlink(tempfile); \
|
||||
cli_unlink(tempfile); \
|
||||
free(tempfile); \
|
||||
FREESEC; \
|
||||
found = 0; \
|
||||
|
@ -116,7 +116,7 @@ if((ndesc = open(tempfile, O_RDWR|O_CREAT|O_TRUNC|O_BINARY, S_IRWXU)) < 0) { \
|
|||
case 2: \
|
||||
free(spinned); \
|
||||
close(ndesc); \
|
||||
unlink(tempfile); \
|
||||
cli_unlink(tempfile); \
|
||||
cli_dbgmsg("PESpin: Size exceeded\n"); \
|
||||
free(tempfile); \
|
||||
break; \
|
||||
|
@ -148,7 +148,7 @@ FSGSTUFF; \
|
|||
default: \
|
||||
cli_dbgmsg(NAME": Unpacking failed\n"); \
|
||||
close(ndesc); \
|
||||
unlink(tempfile); \
|
||||
cli_unlink(tempfile); \
|
||||
cli_multifree FREEME; \
|
||||
free(tempfile); \
|
||||
}
|
||||
|
@ -235,7 +235,7 @@ static int cli_ddump(int desc, int offset, int size, const char *file) {
|
|||
cli_dbgmsg("Can't write to file\n");
|
||||
lseek(desc, pos, SEEK_SET);
|
||||
close(ndesc);
|
||||
unlink(file);
|
||||
cli_unlink(file);
|
||||
return -1;
|
||||
}
|
||||
break;
|
||||
|
@ -244,7 +244,7 @@ static int cli_ddump(int desc, int offset, int size, const char *file) {
|
|||
cli_dbgmsg("Can't write to file\n");
|
||||
lseek(desc, pos, SEEK_SET);
|
||||
close(ndesc);
|
||||
unlink(file);
|
||||
cli_unlink(file);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -248,7 +248,7 @@ static int decode_and_scan(struct rtf_object_data* data, cli_ctx* ctx)
|
|||
data->fd = -1;
|
||||
if(data->name) {
|
||||
if(!cli_leavetemps_flag)
|
||||
unlink(data->name);
|
||||
cli_unlink(data->name);
|
||||
free(data->name);
|
||||
data->name = NULL;
|
||||
}
|
||||
|
|
|
@ -326,7 +326,7 @@ static int cli_scanrar(int desc, cli_ctx *ctx, off_t sfx_offset, uint32_t *sfx_c
|
|||
rc = cli_magic_scandesc(rar_state.ofd,ctx);
|
||||
close(rar_state.ofd);
|
||||
if(!cli_leavetemps_flag)
|
||||
unlink(rar_state.filename);
|
||||
cli_unlink(rar_state.filename);
|
||||
if(rc == CL_VIRUS ) {
|
||||
cli_dbgmsg("RAR: infected with %s\n",*ctx->virname);
|
||||
ret = CL_VIRUS;
|
||||
|
@ -468,7 +468,7 @@ static int cli_scangzip(int desc, cli_ctx *ctx)
|
|||
gzclose(gd);
|
||||
close(fd);
|
||||
if(!cli_leavetemps_flag)
|
||||
unlink(tmpname);
|
||||
cli_unlink(tmpname);
|
||||
free(tmpname);
|
||||
return CL_EMEM;
|
||||
}
|
||||
|
@ -483,7 +483,7 @@ static int cli_scangzip(int desc, cli_ctx *ctx)
|
|||
cli_dbgmsg("GZip: Can't write to file.\n");
|
||||
close(fd);
|
||||
if(!cli_leavetemps_flag)
|
||||
unlink(tmpname);
|
||||
cli_unlink(tmpname);
|
||||
free(tmpname);
|
||||
gzclose(gd);
|
||||
free(buff);
|
||||
|
@ -497,7 +497,7 @@ static int cli_scangzip(int desc, cli_ctx *ctx)
|
|||
if(ret == CL_VIRUS) {
|
||||
close(fd);
|
||||
if(!cli_leavetemps_flag)
|
||||
unlink(tmpname);
|
||||
cli_unlink(tmpname);
|
||||
free(tmpname);
|
||||
return ret;
|
||||
}
|
||||
|
@ -507,13 +507,13 @@ static int cli_scangzip(int desc, cli_ctx *ctx)
|
|||
cli_dbgmsg("GZip: Infected with %s\n", *ctx->virname);
|
||||
close(fd);
|
||||
if(!cli_leavetemps_flag)
|
||||
unlink(tmpname);
|
||||
cli_unlink(tmpname);
|
||||
free(tmpname);
|
||||
return CL_VIRUS;
|
||||
}
|
||||
close(fd);
|
||||
if(!cli_leavetemps_flag)
|
||||
unlink(tmpname);
|
||||
cli_unlink(tmpname);
|
||||
free(tmpname);
|
||||
|
||||
return ret;
|
||||
|
@ -564,7 +564,7 @@ static int cli_scanbzip(int desc, cli_ctx *ctx)
|
|||
cli_dbgmsg("Bzip: Unable to malloc %u bytes.\n", FILEBUFF);
|
||||
close(fd);
|
||||
if(!cli_leavetemps_flag)
|
||||
unlink(tmpname);
|
||||
cli_unlink(tmpname);
|
||||
free(tmpname);
|
||||
fclose(fs);
|
||||
BZ2_bzReadClose(&bzerror, bfd);
|
||||
|
@ -582,7 +582,7 @@ static int cli_scanbzip(int desc, cli_ctx *ctx)
|
|||
BZ2_bzReadClose(&bzerror, bfd);
|
||||
close(fd);
|
||||
if(!cli_leavetemps_flag)
|
||||
unlink(tmpname);
|
||||
cli_unlink(tmpname);
|
||||
free(tmpname);
|
||||
free(buff);
|
||||
fclose(fs);
|
||||
|
@ -596,7 +596,7 @@ static int cli_scanbzip(int desc, cli_ctx *ctx)
|
|||
if(ret == CL_VIRUS) {
|
||||
close(fd);
|
||||
if(!cli_leavetemps_flag)
|
||||
unlink(tmpname);
|
||||
cli_unlink(tmpname);
|
||||
free(tmpname);
|
||||
fclose(fs);
|
||||
return ret;
|
||||
|
@ -608,7 +608,7 @@ static int cli_scanbzip(int desc, cli_ctx *ctx)
|
|||
}
|
||||
close(fd);
|
||||
if(!cli_leavetemps_flag)
|
||||
unlink(tmpname);
|
||||
cli_unlink(tmpname);
|
||||
free(tmpname);
|
||||
fclose(fs);
|
||||
|
||||
|
@ -635,7 +635,7 @@ static int cli_scanszdd(int desc, cli_ctx *ctx)
|
|||
if(ret != CL_SUCCESS) { /* CL_VIRUS or some error */
|
||||
close(ofd);
|
||||
if(!cli_leavetemps_flag)
|
||||
unlink(tmpname);
|
||||
cli_unlink(tmpname);
|
||||
free(tmpname);
|
||||
return ret;
|
||||
}
|
||||
|
@ -645,7 +645,7 @@ static int cli_scanszdd(int desc, cli_ctx *ctx)
|
|||
ret = cli_magic_scandesc(ofd, ctx);
|
||||
close(ofd);
|
||||
if(!cli_leavetemps_flag)
|
||||
unlink(tmpname);
|
||||
cli_unlink(tmpname);
|
||||
free(tmpname);
|
||||
|
||||
return ret;
|
||||
|
@ -682,7 +682,7 @@ static int cli_scanmscab(int desc, cli_ctx *ctx, off_t sfx_offset)
|
|||
ret = cli_scanfile(tempname, ctx);
|
||||
|
||||
if(!cli_leavetemps_flag)
|
||||
unlink(tempname);
|
||||
cli_unlink(tempname);
|
||||
free(tempname);
|
||||
if(ret == CL_VIRUS)
|
||||
break;
|
||||
|
@ -1030,7 +1030,7 @@ static int cli_scanhtml_utf16(int desc, cli_ctx *ctx)
|
|||
if(write(fd, decoded, strlen(decoded)) == -1) {
|
||||
cli_errmsg("cli_scanhtml_utf16: Can't write to file %s\n", tempname);
|
||||
free(decoded);
|
||||
unlink(tempname);
|
||||
cli_unlink(tempname);
|
||||
free(tempname);
|
||||
close(fd);
|
||||
return CL_EIO;
|
||||
|
@ -1044,7 +1044,7 @@ static int cli_scanhtml_utf16(int desc, cli_ctx *ctx)
|
|||
close(fd);
|
||||
|
||||
if(!cli_leavetemps_flag)
|
||||
unlink(tempname);
|
||||
cli_unlink(tempname);
|
||||
else
|
||||
cli_dbgmsg("cli_scanhtml_utf16: Decoded HTML data saved in %s\n", tempname);
|
||||
free(tempname);
|
||||
|
@ -1344,7 +1344,7 @@ static int cli_scancryptff(int desc, cli_ctx *ctx)
|
|||
if(cli_leavetemps_flag)
|
||||
cli_dbgmsg("CryptFF: Decompressed data saved in %s\n", tempfile);
|
||||
else
|
||||
unlink(tempfile);
|
||||
cli_unlink(tempfile);
|
||||
|
||||
free(tempfile);
|
||||
return ret;
|
||||
|
@ -1490,7 +1490,7 @@ static int cli_scanembpe(int desc, cli_ctx *ctx)
|
|||
cli_dbgmsg("cli_scanembpe: Can't write to temporary file\n");
|
||||
close(fd);
|
||||
if(!cli_leavetemps_flag)
|
||||
unlink(tmpname);
|
||||
cli_unlink(tmpname);
|
||||
free(tmpname);
|
||||
return CL_EIO;
|
||||
}
|
||||
|
@ -1502,7 +1502,7 @@ static int cli_scanembpe(int desc, cli_ctx *ctx)
|
|||
cli_dbgmsg("cli_scanembpe: Infected with %s\n", *ctx->virname);
|
||||
close(fd);
|
||||
if(!cli_leavetemps_flag)
|
||||
unlink(tmpname);
|
||||
cli_unlink(tmpname);
|
||||
free(tmpname);
|
||||
return CL_VIRUS;
|
||||
}
|
||||
|
@ -1510,7 +1510,7 @@ static int cli_scanembpe(int desc, cli_ctx *ctx)
|
|||
|
||||
close(fd);
|
||||
if(!cli_leavetemps_flag)
|
||||
unlink(tmpname);
|
||||
cli_unlink(tmpname);
|
||||
free(tmpname);
|
||||
|
||||
/* intentionally ignore possible errors from cli_magic_scandesc */
|
||||
|
|
|
@ -96,7 +96,7 @@ cli_untar(const char *dir, int desc, unsigned int posix, cli_ctx *ctx)
|
|||
ret = cli_magic_scandesc(fout, ctx);
|
||||
close(fout);
|
||||
if (!cli_leavetemps_flag)
|
||||
unlink(fullname);
|
||||
cli_unlink(fullname);
|
||||
if (ret==CL_VIRUS)
|
||||
return CL_VIRUS;
|
||||
fout = -1;
|
||||
|
@ -221,7 +221,7 @@ cli_untar(const char *dir, int desc, unsigned int posix, cli_ctx *ctx)
|
|||
ret = cli_magic_scandesc(fout, ctx);
|
||||
close(fout);
|
||||
if (!cli_leavetemps_flag)
|
||||
unlink(fullname);
|
||||
cli_unlink(fullname);
|
||||
if (ret==CL_VIRUS)
|
||||
return CL_VIRUS;
|
||||
}
|
||||
|
|
|
@ -283,13 +283,13 @@ static int unz(uint8_t *src, uint32_t csize, uint32_t usize, uint16_t method, ui
|
|||
lseek(of, 0, SEEK_SET);
|
||||
ret = cli_magic_scandesc(of, ctx);
|
||||
close(of);
|
||||
if(!cli_leavetemps_flag) unlink(tempfile);
|
||||
if(!cli_leavetemps_flag) cli_unlink(tempfile);
|
||||
if(!tmpd) free(tempfile);
|
||||
return ret;
|
||||
}
|
||||
|
||||
close(of);
|
||||
if(!cli_leavetemps_flag) unlink(tempfile);
|
||||
if(!cli_leavetemps_flag) cli_unlink(tempfile);
|
||||
if(!tmpd) free(tempfile);
|
||||
cli_dbgmsg("cli_unzip: extraction failed\n");
|
||||
return ret;
|
||||
|
|
|
@ -714,14 +714,14 @@ ppt_unlzw(const char *dir, int fd, uint32_t length)
|
|||
|
||||
if(cli_readn(fd, inbuff, stream.avail_in) != (int)stream.avail_in) {
|
||||
close(ofd);
|
||||
unlink(fullname);
|
||||
cli_unlink(fullname);
|
||||
return FALSE;
|
||||
}
|
||||
length -= stream.avail_in;
|
||||
|
||||
if(inflateInit(&stream) != Z_OK) {
|
||||
close(ofd);
|
||||
unlink(fullname);
|
||||
cli_unlink(fullname);
|
||||
cli_warnmsg("ppt_unlzw: inflateInit failed\n");
|
||||
return FALSE;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue