Skip to content

Commit

Permalink
Merge pull request libfann#9 from sebknzl/master
Browse files Browse the repository at this point in the history
fixes heap corruption if sizeof(enum fann_activationfunc_enum) < sizeof(...
  • Loading branch information
steffennissen committed Aug 16, 2014
2 parents e8e3abb + 33ff252 commit 7172367
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/fann_io.c
Original file line number Diff line number Diff line change
Expand Up @@ -488,12 +488,13 @@ struct fann *fann_create_from_fd(FILE * conf, const char *configuration_file)
fann_skip("cascade_activation_functions=");
for(i = 0; i < ann->cascade_activation_functions_count; i++)
{
if(fscanf(conf, "%u ", (unsigned int *)&ann->cascade_activation_functions[i]) != 1)
if(fscanf(conf, "%u ", &tmpVal) != 1)
{
fann_error(NULL, FANN_E_CANT_READ_CONFIG, "cascade_activation_functions", configuration_file);
fann_destroy(ann);
return NULL;
}
ann->cascade_activation_functions[i] = (enum fann_activationfunc_enum)tmpVal;
}

fann_scanf("%u", "cascade_activation_steepnesses_count", &ann->cascade_activation_steepnesses_count);
Expand Down

0 comments on commit 7172367

Please sign in to comment.