From: Eric Kohl Date: Wed, 28 Apr 2010 11:35:34 +0000 (+0000) Subject: [MKHIVE/USETUP] X-Git-Tag: backups/header-work@57446~33^2~34 X-Git-Url: https://git.reactos.org/?p=reactos.git;a=commitdiff_plain;h=1a9d9f441c0b721f0a6e195e70ffd2e384a592f0;hp=9adb79a0d9b3604895b167c6c8e9af526539cb9e [MKHIVE/USETUP] - Fix buffer size calculation for the parser. - Do not try to execute an empty registry instruction Patches by Roel Messiant. - Stop the parser at the first NULL character. Patch by me. svn path=/trunk/; revision=47053 --- diff --git a/reactos/base/setup/usetup/interface/usetup.c b/reactos/base/setup/usetup/interface/usetup.c index ea1711ee3b2..7a97b492c27 100644 --- a/reactos/base/setup/usetup/interface/usetup.c +++ b/reactos/base/setup/usetup/interface/usetup.c @@ -3266,6 +3266,8 @@ RegistryPage(PINPUT_RECORD Ir) DPRINT("Action: %S File: %S Section %S\n", Action, File, Section); + if (Action == NULL) break; // Hackfix + if (!_wcsicmp (Action, L"AddReg")) { Delete = FALSE; diff --git a/reactos/lib/newinflib/infcore.c b/reactos/lib/newinflib/infcore.c index 3582ec56787..b70ce795e19 100644 --- a/reactos/lib/newinflib/infcore.c +++ b/reactos/lib/newinflib/infcore.c @@ -365,7 +365,7 @@ __inline static enum parser_state set_state( struct parser *parser, enum parser_ /* check if the pointer points to an end of file */ __inline static int is_eof( struct parser *parser, const WCHAR *ptr ) { - return (ptr >= parser->end || *ptr == CONTROL_Z); + return (ptr >= parser->end || *ptr == CONTROL_Z || *ptr == 0); } @@ -375,7 +375,8 @@ __inline static int is_eol( struct parser *parser, const WCHAR *ptr ) return (ptr >= parser->end || *ptr == CONTROL_Z || *ptr == '\n' || - (*ptr == '\r' && *(ptr + 1) == '\n')); + (*ptr == '\r' && *(ptr + 1) == '\n') || + *ptr == 0); } diff --git a/reactos/lib/newinflib/infrosgen.c b/reactos/lib/newinflib/infrosgen.c index e994b28f030..b23403b96c0 100644 --- a/reactos/lib/newinflib/infrosgen.c +++ b/reactos/lib/newinflib/infrosgen.c @@ -120,7 +120,7 @@ InfOpenBufferedFile(PHINF InfHandle, Status = InfpParseBuffer(Cache, new_buff, - new_buff + len, + new_buff + len / sizeof(WCHAR), ErrorLine); FREE(new_buff); } @@ -293,7 +293,7 @@ InfOpenFile(PHINF InfHandle, Status = InfpParseBuffer(Cache, new_buff, - new_buff + len, + new_buff + len / sizeof(WCHAR), ErrorLine); FREE(new_buff); }