Module Name: src
Committed By: rin
Date: Fri Nov 10 14:35:25 UTC 2017
Modified Files:
src/external/bsd/nvi/dist/common: vi_db1.c
src/external/bsd/nvi/dist/ex: ex.c
Log Message:
PR bin/52716 fix buffer overrun found by libasan
To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/external/bsd/nvi/dist/common/vi_db1.c
cvs rdiff -u -r1.4 -r1.5 src/external/bsd/nvi/dist/ex/ex.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/external/bsd/nvi/dist/common/vi_db1.c
diff -u src/external/bsd/nvi/dist/common/vi_db1.c:1.8 src/external/bsd/nvi/dist/common/vi_db1.c:1.9
--- src/external/bsd/nvi/dist/common/vi_db1.c:1.8 Sat Nov 28 13:20:03 2015
+++ src/external/bsd/nvi/dist/common/vi_db1.c Fri Nov 10 14:35:25 2017
@@ -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 @@ err3: if (lenp != NULL)
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)) {
Index: src/external/bsd/nvi/dist/ex/ex.c
diff -u src/external/bsd/nvi/dist/ex/ex.c:1.4 src/external/bsd/nvi/dist/ex/ex.c:1.5
--- src/external/bsd/nvi/dist/ex/ex.c:1.4 Sun Jan 26 21:43:45 2014
+++ src/external/bsd/nvi/dist/ex/ex.c Fri Nov 10 14:35:25 2017
@@ -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 @@ ex_comm_search(SCR *sp, CHAR_T *name, si
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);