=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/ssh/channels.c,v retrieving revision 1.345 retrieving revision 1.346 diff -u -r1.345 -r1.346 --- src/usr.bin/ssh/channels.c 2015/06/30 05:23:25 1.345 +++ src/usr.bin/ssh/channels.c 2015/06/30 05:25:07 1.346 @@ -1,4 +1,4 @@ -/* $OpenBSD: channels.c,v 1.345 2015/06/30 05:23:25 djm Exp $ */ +/* $OpenBSD: channels.c,v 1.346 2015/06/30 05:25:07 djm Exp $ */ /* * Author: Tatu Ylonen * Copyright (c) 1995 Tatu Ylonen , Espoo, Finland @@ -2614,7 +2614,7 @@ { Channel *c; int id; - u_int adjust; + u_int adjust, tmp; if (!compat20) return 0; @@ -2630,7 +2630,10 @@ adjust = packet_get_int(); packet_check_eom(); debug2("channel %d: rcvd adjust %u", id, adjust); - c->remote_window += adjust; + if ((tmp = c->remote_window + adjust) < c->remote_window) + fatal("channel %d: adjust %u overflows remote window %u", + id, adjust, c->remote_window); + c->remote_window = tmp; return 0; }