On 01/30/2017 09:46 PM, Nikolay Sivov wrote:
On 31.01.2017 5:51, Zebediah Figura wrote:
Signed-off-by: Zebediah Figura z.figura12@gmail.com
programs/regedit/regproc.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/programs/regedit/regproc.c b/programs/regedit/regproc.c index c055c10..b6de728 100644 --- a/programs/regedit/regproc.c +++ b/programs/regedit/regproc.c @@ -616,8 +616,9 @@ static void processRegEntry31(WCHAR *line) int res;
static WCHAR empty[] = {0};
- static WCHAR hkcr[] = {'H','K','E','Y','_','C','L','A','S','S','E','S','_','R','O','O','T',0};
- if (line[0] == '\0') return;
if (memcmp(line, hkcr, sizeof(hkcr) - sizeof(WCHAR))) return;
/* get key name */ while (line[key_end] && !isspaceW(line[key_end])) key_end++;
Is it guaranteed 'line' is a least that large? Also you can remove terminating 0 from hkcr to avoid sizeof(WCHAR) subtraction.
Sorry for my lack of C knowledge, but isn't this a valid use of memcmp? (And yes, I will fix that; thank you.)