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

Function NewStringSymbol

hyperdbg/script-engine/code/script-engine.c:3691–3710  ·  view source on GitHub ↗

* @brief Allocates a new SYMBOL with string type and returns the reference to it * * @param value * @return PSYMBOL */

Source from the content-addressed store, hash-verified

3689 * @return PSYMBOL
3690 */
3691PSYMBOL
3692NewStringSymbol(PSCRIPT_ENGINE_TOKEN Token)
3693{
3694 PSYMBOL Symbol;
3695 int BufferSize = (SIZE_SYMBOL_WITHOUT_LEN + Token->Len) / sizeof(SYMBOL) + 1;
3696 Symbol = (PSYMBOL)calloc(sizeof(SYMBOL), BufferSize);
3697
3698 if (Symbol == NULL)
3699 {
3700 //
3701 // There was an error allocating buffer
3702 //
3703 return NULL;
3704 }
3705
3706 memcpy(&Symbol->Value, Token->Value, Token->Len);
3707 SetType(&Symbol->Type, SYMBOL_STRING_TYPE);
3708 Symbol->Len = Token->Len;
3709 return Symbol;
3710}
3711
3712/**
3713 * @brief Allocates a new SYMBOL with wstring type and returns the reference to it

Callers 1

ToSymbolFunction · 0.85

Calls 1

SetTypeFunction · 0.85

Tested by

no test coverage detected