MCPcopy Create free account
hub / github.com/HyperDbg/HyperDbg / CheckIfStringIsSafe

Function CheckIfStringIsSafe

hyperdbg/script-eval/code/Functions.c:1297–1318  ·  view source on GitHub ↗

* @brief Check if string is safe to be accessed or not (in vmx-root mode) * * @param StrAddr * @param IsWstring * @return BOOLEAN */

Source from the content-addressed store, hash-verified

1295 * @return BOOLEAN
1296 */
1297BOOLEAN
1298CheckIfStringIsSafe(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.)

Callers 1

Calls 1

Tested by

no test coverage detected