mirror of
https://github.com/reactos/reactos.git
synced 2024-10-30 11:35:58 +00:00
fix incorrect usage of alloca and a buffer overflow
svn path=/trunk/; revision=18540
This commit is contained in:
parent
2c226cd315
commit
18d6c8993b
|
@ -327,7 +327,6 @@ CreateStubs(FILE * SyscallDb,
|
||||||
{
|
{
|
||||||
char Line[INPUT_BUFFER_SIZE];
|
char Line[INPUT_BUFFER_SIZE];
|
||||||
char *NtSyscallName;
|
char *NtSyscallName;
|
||||||
char *ZwSyscallName = NULL;
|
|
||||||
char *SyscallArguments;
|
char *SyscallArguments;
|
||||||
int SyscallId;
|
int SyscallId;
|
||||||
unsigned StackBytes;
|
unsigned StackBytes;
|
||||||
|
@ -344,14 +343,6 @@ CreateStubs(FILE * SyscallDb,
|
||||||
|
|
||||||
/* Make sure we really extracted something */
|
/* Make sure we really extracted something */
|
||||||
if (NtSyscallName) {
|
if (NtSyscallName) {
|
||||||
|
|
||||||
/* Create the ZwXXX name, if requested */
|
|
||||||
if (NeedsZw) {
|
|
||||||
ZwSyscallName = alloca(strlen(NtSyscallName));
|
|
||||||
strcpy(ZwSyscallName, NtSyscallName);
|
|
||||||
ZwSyscallName[0] = 'Z';
|
|
||||||
ZwSyscallName[1] = 'w';
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Create Usermode Stubs for Nt/Zw syscalls in each Usermode file */
|
/* Create Usermode Stubs for Nt/Zw syscalls in each Usermode file */
|
||||||
int i;
|
int i;
|
||||||
|
@ -364,18 +355,28 @@ CreateStubs(FILE * SyscallDb,
|
||||||
SyscallId | Index);
|
SyscallId | Index);
|
||||||
|
|
||||||
/* If a Zw Version is needed (was specified), write it too */
|
/* If a Zw Version is needed (was specified), write it too */
|
||||||
if (ZwSyscallName) WriteUserModeStub(UserModeFiles[i],
|
if (NeedsZw) {
|
||||||
ZwSyscallName,
|
|
||||||
StackBytes,
|
NtSyscallName[0] = 'Z';
|
||||||
SyscallId | Index);
|
NtSyscallName[1] = 'w';
|
||||||
|
WriteUserModeStub(UserModeFiles[i],
|
||||||
|
NtSyscallName,
|
||||||
|
StackBytes,
|
||||||
|
SyscallId | Index);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Create the Kernel coutnerparts (only Zw*, Nt* are the real functions!) */
|
/* Create the Kernel coutnerparts (only Zw*, Nt* are the real functions!) */
|
||||||
if (KernelModeFile) WriteKernelModeStub(KernelModeFile,
|
if (KernelModeFile) {
|
||||||
ZwSyscallName,
|
|
||||||
StackBytes,
|
NtSyscallName[0] = 'Z';
|
||||||
SyscallId | Index);
|
NtSyscallName[1] = 'w';
|
||||||
|
WriteKernelModeStub(KernelModeFile,
|
||||||
|
NtSyscallName,
|
||||||
|
StackBytes,
|
||||||
|
SyscallId | Index);
|
||||||
|
}
|
||||||
|
|
||||||
/* Only increase if we actually added something */
|
/* Only increase if we actually added something */
|
||||||
SyscallId++;
|
SyscallId++;
|
||||||
|
|
Loading…
Reference in a new issue