static void slog(struct site *st, uint32_t event, cstring_t msg, ...)
{
va_list ap;
- uint8_t buf[240];
+ char buf[240];
uint32_t class;
va_start(ap,msg);
int *timeout_io)
{
if (timeout) {
- uint64_t offset=timeout-*now;
+ int64_t offset=timeout-*now;
+ if (offset<0) offset=0;
if (offset>INT_MAX) offset=INT_MAX;
if (*timeout_io<0 || offset<*timeout_io)
*timeout_io=offset;
sprintf(st->tunname,"%s<->%s",st->localname,st->remotename);
/* The information we expect to see in incoming messages of type 1 */
+ /* fixme: lots of unchecked overflows here, but the results are only
+ corrupted packets rather than undefined behaviour */
st->setupsiglen=strlen(st->remotename)+strlen(st->localname)+8;
st->setupsig=safe_malloc(st->setupsiglen,"site_apply");
put_uint32(st->setupsig+0,LABEL_MSG1);