mirror of
https://github.com/switchbrew/libnx.git
synced 2025-06-28 15:52:39 +02:00
Fix bug where attempts to parse __argdata__ while running as an NRO
This commit is contained in:
parent
2103e40448
commit
356a06fb94
@ -1,6 +1,7 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
#include "result.h"
|
#include "result.h"
|
||||||
|
#include "runtime/env.h"
|
||||||
#include "kernel/svc.h"
|
#include "kernel/svc.h"
|
||||||
|
|
||||||
// System globals we define here
|
// System globals we define here
|
||||||
@ -35,11 +36,12 @@ void argvSetup(void)
|
|||||||
__system_argc = 0;
|
__system_argc = 0;
|
||||||
__system_argv = NULL;
|
__system_argv = NULL;
|
||||||
|
|
||||||
|
// TODO: Use envHasArgv() here for the NRO case.
|
||||||
|
|
||||||
|
if (envIsNso()) {
|
||||||
memset(&meminfo, 0, sizeof(meminfo));
|
memset(&meminfo, 0, sizeof(meminfo));
|
||||||
rc = svcQueryMemory(&meminfo, &pageinfo, (u64)argdata);
|
rc = svcQueryMemory(&meminfo, &pageinfo, (u64)argdata);
|
||||||
|
|
||||||
// TODO: Use envHasArgv() here.
|
|
||||||
|
|
||||||
// This memory is only mapped when arguments were passed.
|
// This memory is only mapped when arguments were passed.
|
||||||
if (R_FAILED(rc) || meminfo.perm != 0x3)
|
if (R_FAILED(rc) || meminfo.perm != 0x3)
|
||||||
return;
|
return;
|
||||||
@ -116,5 +118,6 @@ void argvSetup(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
__system_argv[__system_argc] = NULL;
|
__system_argv[__system_argc] = NULL;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user