Rereading that patch (sorry, I've not actually tested it; my home network isn't fast enough to trigger the bug, but it compiles!), I notice I wrote
if (nrepeats < INT_MAX) { where I meant if (tsum < INT_MAX) { which is actually the thing that can overflow. -- David Buckley