Source-Changes-HG archive

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

[src/trunk]: src/external/bsd/nvi/dist PR bin/52716 fix buffer overrun found ...



details:   https://anonhg.NetBSD.org/src/rev/f79b61f07f3e
branches:  trunk
changeset: 827730:f79b61f07f3e
user:      rin <rin%NetBSD.org@localhost>
date:      Fri Nov 10 14:35:25 2017 +0000

description:
PR bin/52716 fix buffer overrun found by libasan

diffstat:

 external/bsd/nvi/dist/common/vi_db1.c |  4 ++--
 external/bsd/nvi/dist/ex/ex.c         |  6 +++---
 2 files changed, 5 insertions(+), 5 deletions(-)

diffs (48 lines):

diff -r 5d8050038e48 -r f79b61f07f3e external/bsd/nvi/dist/common/vi_db1.c
--- a/external/bsd/nvi/dist/common/vi_db1.c     Fri Nov 10 08:52:57 2017 +0000
+++ b/external/bsd/nvi/dist/common/vi_db1.c     Fri Nov 10 14:35:25 2017 +0000
@@ -15,7 +15,7 @@
 static const char sccsid[] = "Id: db1.c,v 10.1 2002/03/09 12:53:57 skimo Exp  (Berkeley) Date: 2002/03/09 12:53:57 ";
 #endif /* not lint */
 #else
-__RCSID("$NetBSD: vi_db1.c,v 1.8 2015/11/28 13:20:03 christos Exp $");
+__RCSID("$NetBSD: vi_db1.c,v 1.9 2017/11/10 14:35:25 rin Exp $");
 #endif
 
 #include <sys/types.h>
@@ -184,7 +184,7 @@
                        nlen = data.size;
                        goto retry;
                } else
-                       memcpy(sp->c_lp, data.data, nlen);
+                       memcpy(sp->c_lp, data.data, data.size);
        }
 
        if (FILE2INT(sp, data.data, data.size, wp, wlen)) {
diff -r 5d8050038e48 -r f79b61f07f3e external/bsd/nvi/dist/ex/ex.c
--- a/external/bsd/nvi/dist/ex/ex.c     Fri Nov 10 08:52:57 2017 +0000
+++ b/external/bsd/nvi/dist/ex/ex.c     Fri Nov 10 14:35:25 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ex.c,v 1.4 2014/01/26 21:43:45 christos Exp $ */
+/*     $NetBSD: ex.c,v 1.5 2017/11/10 14:35:25 rin Exp $ */
 /*-
  * Copyright (c) 1992, 1993, 1994
  *     The Regents of the University of California.  All rights reserved.
@@ -16,7 +16,7 @@
 static const char sccsid[] = "Id: ex.c,v 10.75 2004/03/16 14:13:35 skimo Exp  (Berkeley) Date: 2004/03/16 14:13:35 ";
 #endif /* not lint */
 #else
-__RCSID("$NetBSD: ex.c,v 1.4 2014/01/26 21:43:45 christos Exp $");
+__RCSID("$NetBSD: ex.c,v 1.5 2017/11/10 14:35:25 rin Exp $");
 #endif
 
 #include <sys/types.h>
@@ -2259,7 +2259,7 @@
                        return (NULL);
                if (cp->name[0] != name[0])
                        continue;
-               if (!MEMCMP(name, cp->name, len))
+               if (STRLEN(cp->name) >= len && !MEMCMP(name, cp->name, len))
                        return (cp);
        }
        return (NULL);



Home | Main Index | Thread Index | Old Index