Applying Michael Samuel's patch to avoid buffer overflow while loading
the algorithm name from a dump file.
This commit is contained in:
parent
b8c5b54c9a
commit
f9e5adacbd
@ -38,13 +38,18 @@ cmph_t *__cmph_load(FILE *f)
|
||||
register size_t nbytes;
|
||||
|
||||
DEBUGP("Loading mphf\n");
|
||||
while(1)
|
||||
for(i = 0; i < BUFSIZ; i++)
|
||||
{
|
||||
size_t c = fread(ptr, (size_t)1, (size_t)1, f);
|
||||
if (c != 1) return NULL;
|
||||
if (*ptr == 0) break;
|
||||
++ptr;
|
||||
}
|
||||
if(algo_name[i] != 0)
|
||||
{
|
||||
DEBUGP("Attempted buffer overflow while loading mph file\n");
|
||||
return NULL;
|
||||
}
|
||||
for(i = 0; i < CMPH_COUNT; ++i)
|
||||
{
|
||||
if (strcmp(algo_name, cmph_names[i]) == 0)
|
||||
|
Loading…
Reference in New Issue
Block a user