Follow-up Comment #12, bug #18922 (project freeciv):
> I've retested things and came to conclusion that it's indeed
> malloc->calloc change that's essential for making things work.
One would assume that *either* of your changes would fix the problem in your
particular case (either zeroing structure beforehand, or copying zeroes there)
and memcpy() change would fix this in general case (when zeroes are not the
correct pattern to fill)
> On the other hand, doing memcpy with a different length than
> ai_addrlen doesn't seem to make sense - after all, that
> parameter is for this purpose exactly.
Well, one should not memcpy() more than fits to target. Size of the target
should never be smaller than ai_addrlen so this MIN() is just safeguard
against programming errors from corrupting memory. But it has an error, it
should be size of target, not size of pointer to target.
Reply to this item at:
Message sent via/by Gna!
Freeciv-dev mailing list