Source-Changes-HG archive

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

[src/trunk]: src/sys/kern Fix buffer overflow. It seems that some people need...



details:   https://anonhg.NetBSD.org/src/rev/46978405edf7
branches:  trunk
changeset: 999940:46978405edf7
user:      maxv <maxv%NetBSD.org@localhost>
date:      Tue Jun 25 16:58:02 2019 +0000

description:
Fix buffer overflow. It seems that some people need to go back to the
basics of C programming.

Reported-by: syzbot+8665827f389a9fac5cc9%syzkaller.appspotmail.com@localhost

diffstat:

 sys/kern/kern_exec.c |  6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diffs (27 lines):

diff -r e1f5c1e24dca -r 46978405edf7 sys/kern/kern_exec.c
--- a/sys/kern/kern_exec.c      Tue Jun 25 15:33:55 2019 +0000
+++ b/sys/kern/kern_exec.c      Tue Jun 25 16:58:02 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: kern_exec.c,v 1.468 2019/06/18 23:53:55 kamil Exp $    */
+/*     $NetBSD: kern_exec.c,v 1.469 2019/06/25 16:58:02 maxv Exp $     */
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -59,7 +59,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kern_exec.c,v 1.468 2019/06/18 23:53:55 kamil Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_exec.c,v 1.469 2019/06/25 16:58:02 maxv Exp $");
 
 #include "opt_exec.h"
 #include "opt_execfmt.h"
@@ -656,7 +656,7 @@
        tlen = path + MAXPATHLEN - bp;
 
        memmove(path, bp, tlen);
-       path[tlen] = '\0';
+       path[tlen-1] = '\0';
        if (offs)
                *offs = tlen - len;
 out:



Home | Main Index | Thread Index | Old Index