mirror of
https://github.com/Ylianst/MeshAgent
synced 2025-12-10 13:23:41 +00:00
1. Fixed NULL reference crash that could occur if ILibProcessPipe metadata is NULL when fdsnapshot is called
2. Updated MacOS KVM to set metadata on child process
This commit is contained in:
@@ -703,6 +703,11 @@ void* kvm_relay_setup(char *exePath, void *processPipeMgr, ILibKVM_WriteHandler
|
|||||||
// Spawn child kvm process into a specific user session
|
// Spawn child kvm process into a specific user session
|
||||||
gChildProcess = ILibProcessPipe_Manager_SpawnProcessEx3(processPipeMgr, exePath, parms0, ILibProcessPipe_SpawnTypes_DEFAULT, (void*)(uint64_t)uid, 0);
|
gChildProcess = ILibProcessPipe_Manager_SpawnProcessEx3(processPipeMgr, exePath, parms0, ILibProcessPipe_SpawnTypes_DEFAULT, (void*)(uint64_t)uid, 0);
|
||||||
g_slavekvm = ILibProcessPipe_Process_GetPID(gChildProcess);
|
g_slavekvm = ILibProcessPipe_Process_GetPID(gChildProcess);
|
||||||
|
|
||||||
|
char tmp[255];
|
||||||
|
sprintf_s(tmp, sizeof(tmp), "Child KVM (pid: %d)", g_slavekvm);
|
||||||
|
ILibProcessPipe_Process_ResetMetadata(gChildProcess, tmp);
|
||||||
|
|
||||||
ILibProcessPipe_Process_AddHandlers(gChildProcess, 65535, &kvm_relay_ExitHandler, &kvm_relay_StdOutHandler, &kvm_relay_StdErrHandler, NULL, user);
|
ILibProcessPipe_Process_AddHandlers(gChildProcess, 65535, &kvm_relay_ExitHandler, &kvm_relay_StdOutHandler, &kvm_relay_StdErrHandler, NULL, user);
|
||||||
|
|
||||||
// Run the relay
|
// Run the relay
|
||||||
|
|||||||
@@ -190,9 +190,17 @@ char * ILibProcessPipe_Manager_OnQuery(void *chain, void *object, int fd, size_t
|
|||||||
if (node != NULL)
|
if (node != NULL)
|
||||||
{
|
{
|
||||||
ILibProcessPipe_PipeObject *pj = (ILibProcessPipe_PipeObject*)ILibLinkedList_GetDataFromNode(node);
|
ILibProcessPipe_PipeObject *pj = (ILibProcessPipe_PipeObject*)ILibLinkedList_GetDataFromNode(node);
|
||||||
|
if (pj->metadata != NULL)
|
||||||
|
{
|
||||||
*dataLen = strnlen_s(pj->metadata, 1024);
|
*dataLen = strnlen_s(pj->metadata, 1024);
|
||||||
ret = pj->metadata;
|
ret = pj->metadata;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
*dataLen = 25;
|
||||||
|
ret = "ILibProcessPipe (unknown)";
|
||||||
|
}
|
||||||
|
}
|
||||||
return(ret);
|
return(ret);
|
||||||
}
|
}
|
||||||
void ILibProcessPipe_Manager_OnPreSelect(void* object, fd_set *readset, fd_set *writeset, fd_set *errorset, int* blocktime)
|
void ILibProcessPipe_Manager_OnPreSelect(void* object, fd_set *readset, fd_set *writeset, fd_set *errorset, int* blocktime)
|
||||||
|
|||||||
Reference in New Issue
Block a user