Follow-up Comment #21, bug #20003 (project freeciv): > Well, third one is what I've planned to do for a long time*: > give dio_get_xxx() functions return values telling if they > succeeded or failed. Patch attached. > > *) According to very old TODO I had actually foreseen > possibility of infinite loop somewhere when I first came across > the dio_get_xxx() functions and noticed their lack of return > value. > > Any volunteers to do throughout checking of all dio_get_xxx() > callers in case there's other places where return values (added > by this patch) should be checked.
When working on porting this patch to warclient, numerous questions came to me. I had also noticed something wrong in those functions, including the case of infinite loops and wrong data for a very long time. What value returns the dio_get_xxx() ? According to your comment, I understand that these functions returns TRUE if the value is read and valid. However, the code doesn't match this (for example can dio_get_uint8() returns TRUE even if there was no more byte, functions like dio_get_bit_string() look strange). I guess that all receive_packet_xxx() functions should also test the results of the dio_get_xxx() ones. Also, shouldn't the server of the client cut the connection of a such packet ? It clearly doesn't match the protocol, so it is not a compatible connection. _______________________________________________________ Reply to this item at: <http://gna.org/bugs/?20003> _______________________________________________ Message posté via/par Gna! http://gna.org/ _______________________________________________ Freeciv-dev mailing list Freeciv-dev@gna.org https://mail.gna.org/listinfo/freeciv-dev