From 717107bb65b986889978398f1757c99bd9a412f6 Mon Sep 17 00:00:00 2001 From: Mike McCormack Date: Tue, 28 Oct 2003 21:09:10 +0000 Subject: [PATCH] Fix string value lookups in MSI. --- dlls/msi/table.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/dlls/msi/table.c b/dlls/msi/table.c index 9076161b01a..58719082a90 100644 --- a/dlls/msi/table.c +++ b/dlls/msi/table.c @@ -427,15 +427,21 @@ static UINT msi_string2id( string_table *st, LPCWSTR buffer, UINT *id ) TRACE("Finding string %s in %ld strings\n", debugstr_w(buffer), count); sz = WideCharToMultiByte( CP_ACP, 0, buffer, -1, NULL, 0, NULL, NULL ); + if( sz <= 0 ) + return r; str = HeapAlloc( GetProcessHeap(), 0, sz ); + if( !str ) + return ERROR_NOT_ENOUGH_MEMORY; WideCharToMultiByte( CP_ACP, 0, buffer, -1, str, sz, NULL, NULL ); offset = 0; + sz--; /* nul terminated */ for(i=0; ipool.data[i*2]; if ( ( sz == len ) && !memcmp( str, st->info.data+offset, sz ) ) { + TRACE("%ld <- %s\n",i,debugstr_an(st->info.data+offset, len) ); *id = i; r = ERROR_SUCCESS; break; -- 2.11.4.GIT