summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortobias <tobias@openbsd.org>2014-06-27 20:35:37 +0000
committertobias <tobias@openbsd.org>2014-06-27 20:35:37 +0000
commit2d99e3c1fd106ee0226470086bcee4a727dbd86d (patch)
treec540e0a45a28d958dc7d86646b130a83cd13696a
parentSplit out mmap's compatibility flags into a separate section, so users (diff)
downloadwireguard-openbsd-2d99e3c1fd106ee0226470086bcee4a727dbd86d.tar.xz
wireguard-openbsd-2d99e3c1fd106ee0226470086bcee4a727dbd86d.zip
Avoid buffer overflow on max line length by ending string with just one \0.
ok deraadt@
-rw-r--r--sys/stand/boot/cmd.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/sys/stand/boot/cmd.c b/sys/stand/boot/cmd.c
index ccc2e571f6e..204254f3bec 100644
--- a/sys/stand/boot/cmd.c
+++ b/sys/stand/boot/cmd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cmd.c,v 1.61 2013/12/23 23:32:40 deraadt Exp $ */
+/* $OpenBSD: cmd.c,v 1.62 2014/06/27 20:35:37 tobias Exp $ */
/*
* Copyright (c) 1997-1999 Michael Shalayeff
@@ -283,7 +283,7 @@ readline(char *buf, size_t n, int to)
continue;
case '\n':
case '\r':
- p[1] = *p = '\0';
+ *p = '\0';
break;
case '\b':
case '\177':