Make sure to search DLLs only in safe path, not in current working dir

This commit is contained in:
ValdikSS 2018-02-15 15:41:28 +03:00
parent dc4d0a36d9
commit aa28d3e12a

View File

@ -326,6 +326,10 @@ int main(int argc, char *argv[]) {
char *hdr_name_addr = NULL, *hdr_value_addr = NULL;
int hdr_value_len;
// Make sure to search DLLs only in safe path, not in current working dir.
SetDllDirectory("");
SetSearchPathMode(BASE_SEARCH_PATH_ENABLE_SAFE_SEARCHMODE | BASE_SEARCH_PATH_PERMANENT);
if (!running_from_service) {
running_from_service = 1;
if (service_register(argc, argv)) {