config_t cfg;
const char *str;
- config_init(&cfg);
-
/* Hack for checking if file exists without using external libs.*/
FILE * file = fopen(fname, "r");
if (!file) {
/* File exists, so file has been locked. Release it. */
fclose(file);
+ config_init(&cfg);
+
/* Read the file. If there is an error, report it and exit. */
if(!config_read_file(&cfg, fname))
{
if(config_lookup_string(&cfg, "host", &str)) {
- char host[255];
- strcpy(host, str);//FIXME: buffer overflow
- ConnectList.append(new ConnectEntry(host));
+ ConnectList.append(new ConnectEntry((char*)str));
}
else {
AppConfiguration::error(&cfg);
}
if(config_lookup_string(&cfg, "progdir", &str)){
- strcpy(progdir, str);//FIXME: buffer overflow
+ strncpy(progdir, str, 256);
}
else {
AppConfiguration::error(&cfg);
}
if(config_lookup_string(&cfg, "homedir", &str)){
- strcpy(HomeDir, str);//FIXME: buffer overflow
+ strncpy(HomeDir, str, 255);
}
else {
AppConfiguration::error(&cfg);