Fivetonsofflax / opentyrian

Automatically exported from code.google.com/p/opentyrian
GNU General Public License v2.0
0 stars 0 forks source link

Infinite loop in episodes.c:JE_scanForEpisodes() #85

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Problem:
I just build classic r961 on Fedora 11, and when I start it, it loops
indefinitely in episodes.c:JE_scanForEpisodes().

Cause:
"buf" is too small to fit both the filename _and_ the terminating '\0',
which causes a buffer overflow into "temp", causing the loop to never exit.

Solution:
Increase the size of "buf", see attached patch.
This patch assumes that EPISODES_MAX will always be just one digit though,
and a quick grep through the code shows that in network.c there's an assert
for EPISODES_MAX <= 16. I suppose it's a good idea to make these
consistent, either by increasing the size of "buf" to allow two digits or
by changing the assert to allow only a single digit.

Original issue reported on code.google.com by a.h.vand...@gmail.com on 6 Aug 2009 at 5:48

Attachments:

GoogleCodeExporter commented 9 years ago
made the buffer an even 20 bytes :)

Original comment by mindless...@gmail.com on 6 Aug 2009 at 11:25