Permalink
Browse files

Ini_GetString() can still fill in the defaultValue, even if we have

not successfully loaded a ini file. Without this, many of users of
this function, will what-ever present in the stack as their
configuration-value (Stack-leakage bug).
  • Loading branch information...
mywave82 committed Sep 24, 2018
1 parent 521f500 commit 0573523454be9be5cb00bc64195f452487b509b5
Showing with 3 additions and 1 deletion.
  1. +1 −1 src/inifile.c
  2. +2 −0 src/inifile.h
View
@@ -165,7 +165,7 @@ char *IniFile_GetString(const char *key, const char *defaultValue, char *dest, u
{
char * p;
uint16 i;
if (g_openduneini == NULL) return NULL;
/* if g_openduneini is NULL, Ini_GetString() still does what we expect */
p = Ini_GetString("opendune", key, defaultValue, dest, length, g_openduneini);
if (p) {
/* Trim space from the beginning of the dest */
View
@@ -11,8 +11,10 @@ extern void Free_IniFile(void);
extern bool SetLanguage_From_IniFile(DuneCfg *config);
/* if source is NULL, defaultValue will still be returned */
extern char *IniFile_GetString(const char *key, const char *defaultValue, char *dest, uint16 length);
/* if source is NULL, defaultValue will still be returned */
extern int IniFile_GetInteger(const char *key, int defaultValue);
#endif /* INIFILE_H */

0 comments on commit 0573523

Please sign in to comment.