DIVGAMES / DIV-Games-Studio

Complete cross platform games development package, originally for DOS but now available on modern platforms.
GNU General Public License v3.0
235 stars 30 forks source link

Uninitialized value in net.c #10

Open jonvaldes opened 7 years ago

jonvaldes commented 7 years ago

At this point in net.c, the variable num_games has never been initialized, and thus contains garbage: https://github.com/DIVGAMES/DIV-Games-Studio/blob/master/src/runtime/net.c#L546

Looking at the next lines suggests the solution would be to turn the if into something like this:

if (num_games=_net_get_games(game_id)) {

However, if we do that then the next if would never be executed?

Another option would be to initialize the variable to 0, 1, or whatever a sensible default value is.

MikeDX commented 7 years ago

The netplay code is probably one of the weakest parts of DIV. it only ever worked with IPX, and that was always a bit fickle.

The current version using SDL_Net is also fairly poor, but sort of works.