wine-staging/patches/krnl386.exe-GetPrivateProfileString/0001-krnl386.exe16-Skip-invalid-entries-in-GetPrivateProf.patch

41 lines
1.4 KiB
Diff

From 29e32e5ad41bbd4a2c19202bea2175cfb11c17b1 Mon Sep 17 00:00:00 2001
From: Bruno Jesus <00cpxxx@gmail.com>
Date: Sat, 28 Nov 2015 22:47:38 +0100
Subject: krnl386.exe16: Skip invalid entries in GetPrivateProfileString16.
---
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 77908c2..b66b753 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 );
--
2.6.2