bb12285 - Change to set read permissions on files extracted from RAR archive in case permissions were inadequate.

pull/111/head
Micah Snyder (micasnyd) 6 years ago committed by Micah Snyder
parent e969151915
commit ddc1c9bb11
  1. 21
      libclamav/scanners.c

@ -451,7 +451,26 @@ static cl_error_t cli_scanrar(const char *filepath, int desc, cli_ctx *ctx)
* may need to manually skip the file depending on what, specifically, cli_unrar_extract_file() returned.
*/
} else {
/* File should be extracted...
/*
* File should be extracted...
* ... make sure we have read permissions to the file.
*/
#ifdef _WIN32
if (0 != _access_s(extract_fullpath, R_OK)) {
#else
if (0 != access(extract_fullpath, R_OK)) {
#endif
cli_dbgmsg("RAR: Don't have read permissions, attempting to change file permissions to make it readable..\n");
#ifdef _WIN32
if (0 != _chmod(extract_fullpath, _S_IREAD)) {
#else
if (0 != chmod(extract_fullpath, S_IRUSR | S_IRGRP)) {
#endif
cli_dbgmsg("RAR: Failed to change permission bits so the extracted file is readable..\n");
}
}
/*
* ... scan the extracted file.
*/
cli_dbgmsg("RAR: Extraction complete. Scanning now...\n");

Loading…
Cancel
Save