Source-Changes-HG archive

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

[src/netbsd-8]: src/sys/dist/pf/net Pull up following revision(s) (requested ...



details:   https://anonhg.NetBSD.org/src/rev/9a6ea0fe2098
branches:  netbsd-8
changeset: 851355:9a6ea0fe2098
user:      snj <snj%NetBSD.org@localhost>
date:      Sat Feb 10 04:12:17 2018 +0000

description:
Pull up following revision(s) (requested by maxv in ticket #540):
        sys/dist/pf/net/pf.c: 1.77-1.78
PR/52682: David Binderman: Fix wrong assignment (in the !__NetBSD__ code)
Oh, what is this. Fix a remotely-triggerable integer overflow: the way we
define TCPOLEN_SACK makes it unsigned, and the comparison in the while()
is unsigned too. That's not the expected behavior, the original code
wanted a signed comparison.
It's pretty easy to make 'hlen' go negative and trigger a buffer overflow.
This bug was reported 8 years ago by Lucio Albornoz in PR/44059.

diffstat:

 sys/dist/pf/net/pf.c |  8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diffs (36 lines):

diff -r 12b3d782098b -r 9a6ea0fe2098 sys/dist/pf/net/pf.c
--- a/sys/dist/pf/net/pf.c      Tue Feb 06 20:33:35 2018 +0000
+++ b/sys/dist/pf/net/pf.c      Sat Feb 10 04:12:17 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pf.c,v 1.76 2017/02/14 03:05:06 ozaki-r Exp $  */
+/*     $NetBSD: pf.c,v 1.76.6.1 2018/02/10 04:12:17 snj Exp $  */
 /*     $OpenBSD: pf.c,v 1.552.2.1 2007/11/27 16:37:57 henning Exp $ */
 
 /*
@@ -37,7 +37,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pf.c,v 1.76 2017/02/14 03:05:06 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pf.c,v 1.76.6.1 2018/02/10 04:12:17 snj Exp $");
 
 #include "pflog.h"
 
@@ -1590,7 +1590,7 @@
        struct sackblk sack;
 
 #ifdef __NetBSD__
-#define        TCPOLEN_SACK (2 * sizeof(uint32_t))
+#define        TCPOLEN_SACK            8               /* 2*sizeof(tcp_seq) */
 #endif
 
 #define TCPOLEN_SACKLEN        (TCPOLEN_SACK + 2)
@@ -1708,7 +1708,7 @@
        m->m_pkthdr.pf.tag = rtag;
 
        if (r != NULL && r->rtableid >= 0)
-               m->m_pkthdr.pf.rtableid = m->m_pkthdr.pf.rtableid;
+               m->m_pkthdr.pf.rtableid = r->rtableid;
 #endif /* !__NetBSD__ */
 
 #ifdef ALTQ



Home | Main Index | Thread Index | Old Index