From fdc78a3ed05bc5588b2b94d39e2035e911d155ea Mon Sep 17 00:00:00 2001 From: Dmitry Timoshkov Date: Tue, 19 Dec 2000 19:37:03 +0000 Subject: [PATCH] Protect against NULL buffer in the profile functions. --- files/profile.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/files/profile.c b/files/profile.c index 71dc7f9bd35..d1d3e903e95 100644 --- a/files/profile.c +++ b/files/profile.c @@ -96,6 +96,8 @@ static void PROFILE_CopyEntry( char *buffer, const char *value, int len, char quote = '\0'; const char *p; + if(!buffer) return; + if ((*value == '\'') || (*value == '\"')) { if (value[1] && (value[strlen(value)-1] == *value)) quote = *value++; @@ -761,6 +763,9 @@ static INT PROFILE_GetSection( PROFILESECTION *section, LPCSTR section_name, BOOL return_values ) { PROFILEKEY *key; + + if(!buffer) return 0; + while (section) { if (section->name && !strcasecmp( section->name, section_name )) @@ -808,6 +813,8 @@ static INT PROFILE_GetSectionNames( LPSTR buffer, UINT len ) WORD l, cursize = 0; PROFILESECTION *section; + if(!buffer) return 0; + for (section = CurProfile->section; section; section = section->next) if (section->name) { l = strlen(section->name); @@ -852,6 +859,8 @@ static INT PROFILE_GetString( LPCSTR section, LPCSTR key_name, { PROFILEKEY *key = NULL; + if(!buffer) return 0; + if (!def_val) def_val = ""; if (key_name && key_name[0]) {