[Swan-dev] another bug that could have been caught by strong typing of time

D. Hugh Redelmeier hugh at mimosa.com
Thu Jan 29 08:11:21 EET 2015


programs/pluto/ikev1.c:

		time_t marg = deltamillisecs(
			c->sa_rekey_margin);

milliseconds don't belong in time_t.

Later the value is multiplied AGAIN by 1000 as if this converted it to
milliseconds.  Of course it converts to microseconds and is wrong.

This shows again how easy it is to get the wrong and how useful
compiler help would be.


More information about the Swan-dev mailing list