From d70fd816bbcfe3ed69974e4c2a2dd94318c675c9 Mon Sep 17 00:00:00 2001 From: Theo de Raadt Date: Thu, 19 Jun 1997 10:49:06 +0000 Subject: ensure urgent is within window; TCP/IP Illustrated Vol 2, checked by Andreas.Gunnarsson@emw.ericsson.se --- sys/netinet/tcp_output.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'sys') diff --git a/sys/netinet/tcp_output.c b/sys/netinet/tcp_output.c index a95235a342c..8cf04f566aa 100644 --- a/sys/netinet/tcp_output.c +++ b/sys/netinet/tcp_output.c @@ -1,5 +1,5 @@ -/* $OpenBSD: tcp_output.c,v 1.5 1996/09/12 06:36:57 tholo Exp $ */ -/* $NetBSD: tcp_output.c,v 1.14 1996/02/13 23:43:53 christos Exp $ */ +/* $OpenBSD: tcp_output.c,v 1.6 1997/06/19 10:49:05 deraadt Exp $ */ +/* $NetBSD: tcp_output.c,v 1.16 1997/06/03 16:17:09 kml Exp $ */ /* * Copyright (c) 1982, 1986, 1988, 1990, 1993 @@ -467,7 +467,10 @@ send: win = 0; ti->ti_win = htons((u_int16_t) (win>>tp->rcv_scale)); if (SEQ_GT(tp->snd_up, tp->snd_nxt)) { - ti->ti_urp = htons((u_int16_t)(tp->snd_up - tp->snd_nxt)); + u_int32_t urp = tp->snd_up - tp->snd_nxt; + if (urp > IP_MAXPACKET) + urp = IP_MAXPACKET; + ti->ti_urp = htons((u_int16_t)urp); ti->ti_flags |= TH_URG; } else /* -- cgit v1.2.3