Added patch to fix handling of empty section and key name for profile files.

This commit is contained in:
Sebastian Lackner 2014-11-30 02:39:37 +01:00
parent 557a9e9899
commit 90bd4d997c
5 changed files with 157 additions and 1 deletions

View File

@ -39,10 +39,11 @@ Wine. All those differences are also documented on the
Included bug fixes and improvements
===================================
**Bugfixes and features included in the next upcoming release [7]:**
**Bugfixes and features included in the next upcoming release [8]:**
* Avoid race-conditions of async WSARecv() operations with write watches.
* Black & White needs DXTn software decoding support ([Wine Bug #14939](https://bugs.winehq.org/show_bug.cgi?id=14939))
* Fix handling of empty section and key name for profile files. ([Wine Bug #8036](https://bugs.winehq.org/show_bug.cgi?id=8036))
* Fix issues with dragging layers between images in Adobe Photoshop 7.0 ([Wine Bug #12007](https://bugs.winehq.org/show_bug.cgi?id=12007))
* Fix ordering of IP addresses by metric if two addresses have the same metric.
* Implement exclusive mode in PulseAudio backend ([Wine Bug #37042](https://bugs.winehq.org/show_bug.cgi?id=37042))

1
debian/changelog vendored
View File

@ -19,6 +19,7 @@ wine-compholio (1.7.32) UNRELEASED; urgency=low
* Added patch to change bug reporting URL in winedbg.
* Added patch to implement semi-stub for psapi/kernel32 K32EnumProcessModulesEx.
* Added patch to fix ordering of IP addresses by metric if two addresses have the same metric.
* Added patch to fix handling of empty section and key name for profile files.
* Removed patch to close server fd is there is no space in thread inflight fd list (accepted upstream).
* Removed patch to fix bugs in StrStr functions (accepted upstream).
* Removed patches to avoid sending messages in FindWindowExW (accepted upstream).

View File

@ -50,6 +50,7 @@ PATCHLIST := \
kernel32-GetSystemTimes.ok \
kernel32-GetVolumePathName.ok \
kernel32-Named_Pipe.ok \
kernel32-Profile.ok \
kernel32-UTF7_Support.ok \
libs-Unicode_Collation.ok \
libwine-BSD_mmap_fixed.ok \
@ -700,6 +701,21 @@ kernel32-Named_Pipe.ok:
echo '+ { "Dan Kegel", "kernel32: ConnectNamedPort should return FALSE and set ERROR_PIPE_CONNECTED on success in overlapped mode.", 1 },'; \
) > kernel32-Named_Pipe.ok
# Patchset kernel32-Profile
# |
# | This patchset fixes the following Wine bugs:
# | * [#8036] Fix handling of empty section and key name for profile files.
# |
# | Modified files:
# | * dlls/kernel32/profile.c, dlls/kernel32/tests/profile.c
# |
.INTERMEDIATE: kernel32-Profile.ok
kernel32-Profile.ok:
$(call APPLY_FILE,kernel32-Profile/0001-kernel32-Allow-empty-profile-section-and-key-name-st.patch)
@( \
echo '+ { "Claudio Fontana", "kernel32: Allow empty profile section and key name strings.", 1 },'; \
) > kernel32-Profile.ok
# Patchset kernel32-UTF7_Support
# |
# | This patchset fixes the following Wine bugs:

View File

@ -0,0 +1,137 @@
From fbe441532820151b6fbb6462378cf2465303cf80 Mon Sep 17 00:00:00 2001
From: Claudio Fontana <claudio.fontana@linaro.org>
Date: Sat, 29 Nov 2014 22:06:20 +0100
Subject: kernel32: Allow empty profile section and key name strings.
Consider "" a normal section, and fix calculation for zero
length section name string and key name string.
Signed-off-by: Claudio Fontana <claudio.fontana@gmail.com>
Changes by Sebastian Lackner <sebastian@fds-team.de>:
* Several style improvements, remove todo_wine from tests
---
dlls/kernel32/profile.c | 40 ++++++++++++++++------------------------
dlls/kernel32/tests/profile.c | 2 --
2 files changed, 16 insertions(+), 26 deletions(-)
diff --git a/dlls/kernel32/profile.c b/dlls/kernel32/profile.c
index a9a11b1..fb35c90 100644
--- a/dlls/kernel32/profile.c
+++ b/dlls/kernel32/profile.c
@@ -500,7 +500,7 @@ static BOOL PROFILE_DeleteSection( PROFILESECTION **section, LPCWSTR name )
{
while (*section)
{
- if ((*section)->name[0] && !strcmpiW( (*section)->name, name ))
+ if (!strcmpiW( (*section)->name, name ))
{
PROFILESECTION *to_del = *section;
*section = to_del->next;
@@ -524,7 +524,7 @@ static BOOL PROFILE_DeleteKey( PROFILESECTION **section,
{
while (*section)
{
- if ((*section)->name[0] && !strcmpiW( (*section)->name, section_name ))
+ if (!strcmpiW( (*section)->name, section_name ))
{
PROFILEKEY **key = &(*section)->key;
while (*key)
@@ -556,7 +556,7 @@ static void PROFILE_DeleteAllKeys( LPCWSTR section_name)
PROFILESECTION **section= &CurProfile->section;
while (*section)
{
- if ((*section)->name[0] && !strcmpiW( (*section)->name, section_name ))
+ if (!strcmpiW( (*section)->name, section_name ))
{
PROFILEKEY **key = &(*section)->key;
while (*key)
@@ -582,31 +582,28 @@ static PROFILEKEY *PROFILE_Find( PROFILESECTION **section, LPCWSTR section_name,
LPCWSTR key_name, BOOL create, BOOL create_always )
{
LPCWSTR p;
- int seclen, keylen;
+ int seclen = 0, keylen = 0;
while (PROFILE_isspaceW(*section_name)) section_name++;
if (*section_name)
+ {
p = section_name + strlenW(section_name) - 1;
- else
- p = section_name;
-
- while ((p > section_name) && PROFILE_isspaceW(*p)) p--;
- seclen = p - section_name + 1;
+ while ((p > section_name) && PROFILE_isspaceW(*p)) p--;
+ seclen = p - section_name + 1;
+ }
while (PROFILE_isspaceW(*key_name)) key_name++;
if (*key_name)
+ {
p = key_name + strlenW(key_name) - 1;
- else
- p = key_name;
-
- while ((p > key_name) && PROFILE_isspaceW(*p)) p--;
- keylen = p - key_name + 1;
+ while ((p > key_name) && PROFILE_isspaceW(*p)) p--;
+ keylen = p - key_name + 1;
+ }
while (*section)
{
- if ( ((*section)->name[0])
- && (!(strncmpiW( (*section)->name, section_name, seclen )))
- && (((*section)->name)[seclen] == '\0') )
+ if (!strncmpiW((*section)->name, section_name, seclen) &&
+ ((*section)->name)[seclen] == '\0')
{
PROFILEKEY **key = &(*section)->key;
@@ -873,7 +870,7 @@ static INT PROFILE_GetSection( PROFILESECTION *section, LPCWSTR section_name,
while (section)
{
- if (section->name[0] && !strcmpiW( section->name, section_name ))
+ if (!strcmpiW( section->name, section_name ))
{
UINT oldlen = len;
for (key = section->key; key; key = key->next)
@@ -988,11 +985,6 @@ static INT PROFILE_GetString( LPCWSTR section, LPCWSTR key_name,
if (!def_val) def_val = empty_strW;
if (key_name)
{
- if (!key_name[0])
- {
- PROFILE_CopyEntry(buffer, def_val, len, TRUE);
- return strlenW(buffer);
- }
key = PROFILE_Find( &CurProfile->section, section, key_name, FALSE, FALSE);
PROFILE_CopyEntry( buffer, (key && key->value) ? key->value : def_val,
len, TRUE );
@@ -1002,7 +994,7 @@ static INT PROFILE_GetString( LPCWSTR section, LPCWSTR key_name,
return strlenW( buffer );
}
/* no "else" here ! */
- if (section && section[0])
+ if (section)
{
INT ret = PROFILE_GetSection(CurProfile->section, section, buffer, len, FALSE);
if (!buffer[0]) /* no luck -> def_val */
diff --git a/dlls/kernel32/tests/profile.c b/dlls/kernel32/tests/profile.c
index 2eb90a8..990aa14 100644
--- a/dlls/kernel32/tests/profile.c
+++ b/dlls/kernel32/tests/profile.c
@@ -154,9 +154,7 @@ static void test_profile_string(void)
/* works only in unicode, ascii crashes */
ret=GetPrivateProfileStringW(sW, emptyW, emptyW, bufW,
sizeof(bufW)/sizeof(bufW[0]), TESTFILE2W);
- todo_wine
ok(ret == 10, "expected 10, got %u\n", ret);
- todo_wine
ok(!lstrcmpW(valnokeyW,bufW), "expected %s, got %s\n",
wine_dbgstr_w(valnokeyW), wine_dbgstr_w(bufW) );
--
2.1.3

View File

@ -0,0 +1 @@
Fixes: [8036] Fix handling of empty section and key name for profile files.