fix crash with wrong pointer indirection in setup.c
authorWilfried Goesgens <dothebart@citadel.org>
Sun, 3 Jul 2011 23:08:30 +0000 (23:08 +0000)
committerWilfried Goesgens <dothebart@citadel.org>
Sun, 4 Sep 2011 21:28:40 +0000 (21:28 +0000)
citadel/utils/setup.c

index ae7b28ecd3a728cf30f359667f3f59bbf5d55387..8f9cd5867ae9949064fb48201479dbc57fca1e19 100644 (file)
@@ -1278,17 +1278,17 @@ void GetDefaultValChar(char *WhereTo, const char *VarName, char DefVal)
                *WhereTo = atoi(ch);
        }
 }
-#define GetDefaultVALSTR(CFGNAME, DEFL) GetDefaultValStr((char**)&config.CFGNAME, sizeof(config.CFGNAME), "CITADEL_"#CFGNAME, DEFL)
-void GetDefaultValStr(char **WhereTo, size_t nMax, const char *VarName, const char *DefVal)
+#define GetDefaultVALSTR(CFGNAME, DEFL) GetDefaultValStr(&config.CFGNAME[0], sizeof(config.CFGNAME), "CITADEL_"#CFGNAME, DEFL)
+void GetDefaultValStr(char *WhereTo, size_t nMax, const char *VarName, const char *DefVal)
 {
        const char *ch;
-       if (**WhereTo == '\0') 
-               safestrncpy(*WhereTo, DefVal, nMax);
+       if (*WhereTo == '\0') 
+               safestrncpy(WhereTo, DefVal, nMax);
 
        if ((setup_type == UI_SILENT) &&
            (ch = getenv(VarName), ch != NULL))
        {
-               safestrncpy(*WhereTo, ch, nMax);
+               safestrncpy(WhereTo, ch, nMax);
        }
 }