Source-Changes-HG archive

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

[src/trunk]: src/sys/dist/pf/net Oh, what is this. Fix a remotely-triggerable...



details:   https://anonhg.NetBSD.org/src/rev/1cbf20b4852b
branches:  trunk
changeset: 829737:1cbf20b4852b
user:      maxv <maxv%NetBSD.org@localhost>
date:      Fri Feb 09 21:25:04 2018 +0000

description:
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 |  6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diffs (27 lines):

diff -r 45e94baddc2f -r 1cbf20b4852b sys/dist/pf/net/pf.c
--- a/sys/dist/pf/net/pf.c      Fri Feb 09 18:45:55 2018 +0000
+++ b/sys/dist/pf/net/pf.c      Fri Feb 09 21:25:04 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pf.c,v 1.77 2017/10/31 15:00:03 christos Exp $ */
+/*     $NetBSD: pf.c,v 1.78 2018/02/09 21:25:04 maxv 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.77 2017/10/31 15:00:03 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pf.c,v 1.78 2018/02/09 21:25:04 maxv 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)



Home | Main Index | Thread Index | Old Index