mirror of
https://github.com/switchbrew/libnx.git
synced 2025-06-28 07:42:55 +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 <ctype.h>
|
||||
#include "result.h"
|
||||
#include "runtime/env.h"
|
||||
#include "kernel/svc.h"
|
||||
|
||||
// System globals we define here
|
||||
@ -35,11 +36,12 @@ void argvSetup(void)
|
||||
__system_argc = 0;
|
||||
__system_argv = NULL;
|
||||
|
||||
// TODO: Use envHasArgv() here for the NRO case.
|
||||
|
||||
if (envIsNso()) {
|
||||
memset(&meminfo, 0, sizeof(meminfo));
|
||||
rc = svcQueryMemory(&meminfo, &pageinfo, (u64)argdata);
|
||||
|
||||
// TODO: Use envHasArgv() here.
|
||||
|
||||
// This memory is only mapped when arguments were passed.
|
||||
if (R_FAILED(rc) || meminfo.perm != 0x3)
|
||||
return;
|
||||
@ -116,5 +118,6 @@ void argvSetup(void)
|
||||
}
|
||||
|
||||
__system_argv[__system_argc] = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user