Module Name: src Committed By: maxv Date: Tue Jun 25 16:58:02 UTC 2019
Modified Files: src/sys/kern: kern_exec.c Log Message: Fix buffer overflow. It seems that some people need to go back to the basics of C programming. Reported-by: syzbot+8665827f389a9fac5...@syzkaller.appspotmail.com To generate a diff of this commit: cvs rdiff -u -r1.468 -r1.469 src/sys/kern/kern_exec.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/kern/kern_exec.c diff -u src/sys/kern/kern_exec.c:1.468 src/sys/kern/kern_exec.c:1.469 --- src/sys/kern/kern_exec.c:1.468 Tue Jun 18 23:53:55 2019 +++ src/sys/kern/kern_exec.c Tue Jun 25 16:58:02 2019 @@ -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 @@ exec_makepathbuf(struct lwp *l, const ch tlen = path + MAXPATHLEN - bp; memmove(path, bp, tlen); - path[tlen] = '\0'; + path[tlen-1] = '\0'; if (offs) *offs = tlen - len; out: