From 90eb14a6c4d4d2549894a04655a6f38ceb6998d2 Mon Sep 17 00:00:00 2001 From: Bruno Jesus <00cpxxx@gmail.com> Date: Sat, 28 Nov 2015 22:47:38 +0100 Subject: [PATCH] krnl386.exe16: Skip invalid entries in GetPrivateProfileString16. Signed-off-by: Bruno Jesus <00cpxxx@gmail.com> Signed-off-by: Alexandre Julliard --- dlls/krnl386.exe16/file.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/dlls/krnl386.exe16/file.c b/dlls/krnl386.exe16/file.c index 77908c2a6c4..b66b753236a 100644 --- a/dlls/krnl386.exe16/file.c +++ b/dlls/krnl386.exe16/file.c @@ -539,6 +539,9 @@ INT16 WINAPI GetPrivateProfileString16( LPCSTR section, LPCSTR entry, LPCSTR def_val, LPSTR buffer, UINT16 len, LPCSTR filename ) { + TRACE("(%s, %s, %s, %p, %u, %s)\n", debugstr_a(section), debugstr_a(entry), + debugstr_a(def_val), buffer, len, debugstr_a(filename)); + if (!section) { if (buffer && len) buffer[0] = 0; @@ -572,7 +575,12 @@ INT16 WINAPI GetPrivateProfileString16( LPCSTR section, LPCSTR entry, { char *p = strchr( src, '=' ); - if (!p) p = src + strlen(src); + /* A valid entry is formed by name = value */ + if (!p) + { + src += strlen(src) + 1; + continue; + } if (p - src < len) { memcpy( buffer, src, p - src );