Commit fdc78a3e authored by Dmitry Timoshkov's avatar Dmitry Timoshkov Committed by Alexandre Julliard

Protect against NULL buffer in the profile functions.

parent 4e62b9df
...@@ -96,6 +96,8 @@ static void PROFILE_CopyEntry( char *buffer, const char *value, int len, ...@@ -96,6 +96,8 @@ static void PROFILE_CopyEntry( char *buffer, const char *value, int len,
char quote = '\0'; char quote = '\0';
const char *p; const char *p;
if(!buffer) return;
if ((*value == '\'') || (*value == '\"')) if ((*value == '\'') || (*value == '\"'))
{ {
if (value[1] && (value[strlen(value)-1] == *value)) quote = *value++; if (value[1] && (value[strlen(value)-1] == *value)) quote = *value++;
...@@ -761,6 +763,9 @@ static INT PROFILE_GetSection( PROFILESECTION *section, LPCSTR section_name, ...@@ -761,6 +763,9 @@ static INT PROFILE_GetSection( PROFILESECTION *section, LPCSTR section_name,
BOOL return_values ) BOOL return_values )
{ {
PROFILEKEY *key; PROFILEKEY *key;
if(!buffer) return 0;
while (section) while (section)
{ {
if (section->name && !strcasecmp( section->name, section_name )) if (section->name && !strcasecmp( section->name, section_name ))
...@@ -808,6 +813,8 @@ static INT PROFILE_GetSectionNames( LPSTR buffer, UINT len ) ...@@ -808,6 +813,8 @@ static INT PROFILE_GetSectionNames( LPSTR buffer, UINT len )
WORD l, cursize = 0; WORD l, cursize = 0;
PROFILESECTION *section; PROFILESECTION *section;
if(!buffer) return 0;
for (section = CurProfile->section; section; section = section->next) for (section = CurProfile->section; section; section = section->next)
if (section->name) { if (section->name) {
l = strlen(section->name); l = strlen(section->name);
...@@ -852,6 +859,8 @@ static INT PROFILE_GetString( LPCSTR section, LPCSTR key_name, ...@@ -852,6 +859,8 @@ static INT PROFILE_GetString( LPCSTR section, LPCSTR key_name,
{ {
PROFILEKEY *key = NULL; PROFILEKEY *key = NULL;
if(!buffer) return 0;
if (!def_val) def_val = ""; if (!def_val) def_val = "";
if (key_name && key_name[0]) if (key_name && key_name[0])
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment