Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/netinet fix off-by-one



details:   https://anonhg.NetBSD.org/src/rev/2e6c6b5c836d
branches:  trunk
changeset: 820217:2e6c6b5c836d
user:      christos <christos%NetBSD.org@localhost>
date:      Tue Jan 03 13:09:33 2017 +0000

description:
fix off-by-one

diffstat:

 sys/netinet/tcp_output.c |  11 +++++------
 1 files changed, 5 insertions(+), 6 deletions(-)

diffs (46 lines):

diff -r d36a74e8fa6b -r 2e6c6b5c836d sys/netinet/tcp_output.c
--- a/sys/netinet/tcp_output.c  Tue Jan 03 12:42:06 2017 +0000
+++ b/sys/netinet/tcp_output.c  Tue Jan 03 13:09:33 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: tcp_output.c,v 1.189 2017/01/02 02:38:54 christos Exp $        */
+/*     $NetBSD: tcp_output.c,v 1.190 2017/01/03 13:09:33 christos Exp $        */
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -135,7 +135,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: tcp_output.c,v 1.189 2017/01/02 02:38:54 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tcp_output.c,v 1.190 2017/01/03 13:09:33 christos Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -566,8 +566,8 @@
        struct ip6_hdr *ip6;
 #endif
        struct tcphdr *th;
-       u_char opt[MAX_TCPOPTLEN], *optp;
-#define OPT_FITS(more) ((optlen + (more)) <= sizeof(opt))
+       u_char opt[MAX_TCPOPTLEN + 1], *optp;
+#define OPT_FITS(more) ((optlen + (more)) < sizeof(opt))
        unsigned optlen, hdrlen, packetlen;
        unsigned int sack_numblks;
        int idle, sendalot, txsegsize, rxsegsize;
@@ -1219,7 +1219,6 @@
                }
        }
 
-
 #ifdef TCP_SIGNATURE
        if (tp->t_flags & TF_SIGNATURE) {
                /*
@@ -1279,7 +1278,7 @@
        /* Terminate and pad TCP options to a 4 byte boundary. */
        if (optlen % 4) {
                if (!OPT_FITS(1)) {
-reset:                  TCP_REASS_UNLOCK(tp);
+reset:                 TCP_REASS_UNLOCK(tp);
                        error = ECONNABORTED;
                        goto out;
                }



Home | Main Index | Thread Index | Old Index