Merge in SNORT/snort3 from ~ARNSINGH/snort3:coverity_fstat_fix to master
Squashed commit of the following:
commit
bd20bb8eb0e070dbe5d3d08038a46aee6d911670
Author: Arnab <arnsingh@cisco.com>
Date: Thu Nov 20 12:27:49 2025 +0530
file_api : coverity fix
const std::string& file_full_name = file_info->get_file_name();
- /*Check whether the file exists*/
- struct stat buffer;
- if (stat (file_full_name.c_str(), &buffer) == 0)
+ FILE* fh = fopen(file_full_name.c_str(), "wx");
+ if (!fh)
{
return;
}
-
- FILE* fh = fopen(file_full_name.c_str(), "w");
- if (!fh )
- {
- return;
- }
-
// Check the file buffer
uint8_t* buff = nullptr;
int size = 0;
}
}
fp_eval_service_group(p, conf->snort_protocol_id);
- if (set_file_context)
- files->set_current_file_context(nullptr);
/* Check whether file transfer is done or type depth is reached */
if ((position == SNORT_FILE_END) || (position == SNORT_FILE_FULL) || depth_exhausted)
finalize_file_type();
+ if (set_file_context)
+ files->set_current_file_context(nullptr);
}
void FileContext::process_file_type(Packet* pkt,const uint8_t* file_data, int data_size,