...
| Code Block | ||||
|---|---|---|---|---|
| ||||
HANDLE hFile = CreateFile( pFullPathNamefile_name, GENERIC_READ | GENERIC_WRITE, 0, 0, NULL, OPEN_EXISTING, 0FILE_ATTRIBUTE_NORMAL, NULL ); if (hFile == INVALID_HANDLE_VALUE) { /* Handle error */ } else { if (GetFileType(hFile) != FILE_TYPE_DISK) { /* Handle error */ CloseHandle(hFile); } else { /* Operate on file */ CloseHandle(hFile); } |
Risk Assessment
Allowing operations that are appropriate only for files to be performed on devices can result in denial-of-service attacks or more serious exploits depending on the platform.
...