* @brief Check if string is safe to be accessed or not (in vmx-root mode) * * @param StrAddr * @param IsWstring * @return BOOLEAN */
| 1295 | * @return BOOLEAN |
| 1296 | */ |
| 1297 | BOOLEAN |
| 1298 | CheckIfStringIsSafe(UINT64 StrAddr, BOOLEAN IsWstring) |
| 1299 | { |
| 1300 | #ifdef SCRIPT_ENGINE_USER_MODE |
| 1301 | return TRUE; |
| 1302 | #endif // SCRIPT_ENGINE_USER_MODE |
| 1303 | |
| 1304 | #ifdef SCRIPT_ENGINE_KERNEL_MODE |
| 1305 | |
| 1306 | // |
| 1307 | // At least two chars (wchar_t is 4 byte) |
| 1308 | // |
| 1309 | if (CheckAccessValidityAndSafety(StrAddr, IsWstring ? 4 : 2)) |
| 1310 | { |
| 1311 | return TRUE; |
| 1312 | } |
| 1313 | else |
| 1314 | { |
| 1315 | return FALSE; |
| 1316 | } |
| 1317 | #endif // SCRIPT_ENGINE_KERNEL_MODE |
| 1318 | } |
| 1319 | |
| 1320 | /** |
| 1321 | * @brief Apply format specifiers (%d, %x, %llx, etc.) |
no test coverage detected