Skip to content

Commit

Permalink
Fix buffer overflow. It seems that some people need to go back to the
Browse files Browse the repository at this point in the history
basics of C programming.

Reported-by: syzbot+8665827f389a9fac5cc9@syzkaller.appspotmail.com
  • Loading branch information
maxv authored and maxv committed Jun 25, 2019
1 parent b74dd01 commit c958d6f
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions sys/kern/kern_exec.c
Original file line number Diff line number Diff line change
@@ -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.
Expand Down Expand Up @@ -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"
Expand Down Expand Up @@ -656,7 +656,7 @@ exec_makepathbuf(struct lwp *l, const char *upath, enum uio_seg seg,
tlen = path + MAXPATHLEN - bp;

memmove(path, bp, tlen);
path[tlen] = '\0';
path[tlen-1] = '\0';
if (offs)
*offs = tlen - len;
out:
Expand Down

0 comments on commit c958d6f

Please sign in to comment.