From e37261dff33af23f37202cfce0848d36f5c1055c Mon Sep 17 00:00:00 2001 From: "dtucker@openbsd.org" Date: Fri, 3 Mar 2023 02:37:58 +0000 Subject: upstream: Use time_t for x11_refuse_time timeout. We need SSH_TIME_T_MAX for this, so move from misc.c to misc.h so it's available. Fixes a Coverity warning for 64bit time_t safety, ok djm@ OpenBSD-Commit-ID: c69c4c3152cdaab953706db4ccf4d5fd682f7d8d --- clientloop.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'clientloop.c') diff --git a/clientloop.c b/clientloop.c index fef9efc6..b46fcdde 100644 --- a/clientloop.c +++ b/clientloop.c @@ -1,4 +1,4 @@ -/* $OpenBSD: clientloop.c,v 1.387 2023/01/06 02:39:59 djm Exp $ */ +/* $OpenBSD: clientloop.c,v 1.388 2023/03/03 02:37:58 dtucker Exp $ */ /* * Author: Tatu Ylonen * Copyright (c) 1995 Tatu Ylonen , Espoo, Finland @@ -158,7 +158,7 @@ static int connection_in; /* Connection to server (input). */ static int connection_out; /* Connection to server (output). */ static int need_rekeying; /* Set to non-zero if rekeying is requested. */ static int session_closed; /* In SSH2: login session closed. */ -static u_int x11_refuse_time; /* If >0, refuse x11 opens after this time. */ +static time_t x11_refuse_time; /* If >0, refuse x11 opens after this time. */ static time_t server_alive_time; /* Time to do server_alive_check */ static int hostkeys_update_complete; static int session_setup_complete; @@ -376,8 +376,8 @@ client_x11_get_proto(struct ssh *ssh, const char *display, if (timeout != 0 && x11_refuse_time == 0) { now = monotime() + 1; - if (UINT_MAX - timeout < now) - x11_refuse_time = UINT_MAX; + if (SSH_TIME_T_MAX - timeout < now) + x11_refuse_time = SSH_TIME_T_MAX; else x11_refuse_time = now + timeout; channel_set_x11_refuse_time(ssh, @@ -1617,7 +1617,7 @@ client_request_x11(struct ssh *ssh, const char *request_type, int rchan) "malicious server."); return NULL; } - if (x11_refuse_time != 0 && (u_int)monotime() >= x11_refuse_time) { + if (x11_refuse_time != 0 && monotime() >= x11_refuse_time) { verbose("Rejected X11 connection after ForwardX11Timeout " "expired"); return NULL; -- cgit v1.2.1