Source-Changes-HG archive

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

[src/trunk]: src/sys/compat/ibcs2 Make sure we move forward over the buffer.



details:   https://anonhg.NetBSD.org/src/rev/1a3d0f5f091f
branches:  trunk
changeset: 825706:1a3d0f5f091f
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Fri Jul 28 15:51:35 2017 +0000

description:
Make sure we move forward over the buffer.

>From Ilja Van Sprundel.

diffstat:

 sys/compat/ibcs2/ibcs2_exec_coff.c |  7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)

diffs (28 lines):

diff -r a13da2f6aa11 -r 1a3d0f5f091f sys/compat/ibcs2/ibcs2_exec_coff.c
--- a/sys/compat/ibcs2/ibcs2_exec_coff.c        Fri Jul 28 15:50:04 2017 +0000
+++ b/sys/compat/ibcs2/ibcs2_exec_coff.c        Fri Jul 28 15:51:35 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ibcs2_exec_coff.c,v 1.28 2017/07/28 15:50:04 riastradh Exp $   */
+/*     $NetBSD: ibcs2_exec_coff.c,v 1.29 2017/07/28 15:51:35 riastradh Exp $   */
 
 /*
  * Copyright (c) 1994, 1995, 1998 Scott Bartram
@@ -35,7 +35,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ibcs2_exec_coff.c,v 1.28 2017/07/28 15:50:04 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ibcs2_exec_coff.c,v 1.29 2017/07/28 15:51:35 riastradh Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -469,7 +469,8 @@
                        /* path_index = slhdr->path_index * sizeof(long); */
                        entry_len = slhdr->entry_len * sizeof(long);
 
-                       if (entry_len > len ||
+                       if (entry_len < sizeof(struct coff_slhdr) ||
+                           entry_len > len ||
                            strnlen(slhdr->sl_name, entry_len) == entry_len) {
                                free(tbuf, M_TEMP);
                                return ENOEXEC;



Home | Main Index | Thread Index | Old Index