iterator limit doesn't match malloc in protocol list code
illwieckz opened this issue · 3 comments
illwieckz commented
as @stevenh said in comments of #13,
In this code:
sorted_types = (server_type **)malloc(sizeof(server_type*) * n_server_types);
type = &types[0];
for (i = 0; type->id != Q_UNKNOWN_TYPE; type++, i++) // ← HERE
{
sorted_types[i] = type;
}
The iterator limit doesn't match malloc.
This issue is there since the initial revision.
illwieckz commented
This code must be refactored to be usable by some other parts (for example the json protocol listing).
illwieckz commented
I will probably not have time to code the 8 next days but I can merge existing code and re-push, so if you have a ready-to-use replacement I can copy-past it here and in qstat.c
and add the commit to the PR.
illwieckz commented
@stevenh is this issue can be fixed? It's a 13 years old qstat issue and it blocks 5 pull requests to be merged.
The bug is still there in the last revision: https://github.com/multiplay/qstat/blob/2a95a5d04c8bed54b1a035607989dab101698ce4/qstat.c#L2655