summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoryasuoka <yasuoka@openbsd.org>2019-04-02 10:50:20 +0000
committeryasuoka <yasuoka@openbsd.org>2019-04-02 10:50:20 +0000
commita99eef19e79dd15c8379393894bd0e55179d7978 (patch)
treedfcee98f409b4ccbabd70a14ab77803e49b6e131
parentclear the BCAST and MCAST mbuf flags for "outgoing" packets. (diff)
downloadwireguard-openbsd-a99eef19e79dd15c8379393894bd0e55179d7978.tar.xz
wireguard-openbsd-a99eef19e79dd15c8379393894bd0e55179d7978.zip
Fix ddb not to write its history to out of the region. When the
inputted line just ends at sizeof(db_history), ddb started writing the histories to out of the region. diff from IIJ. ok deraadt anton
-rw-r--r--sys/ddb/db_input.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/sys/ddb/db_input.c b/sys/ddb/db_input.c
index 51cb939e173..2c180369fed 100644
--- a/sys/ddb/db_input.c
+++ b/sys/ddb/db_input.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: db_input.c,v 1.16 2016/04/19 12:23:25 mpi Exp $ */
+/* $OpenBSD: db_input.c,v 1.17 2019/04/02 10:50:20 yasuoka Exp $ */
/* $NetBSD: db_input.c,v 1.7 1996/02/05 01:57:02 christos Exp $ */
/*
@@ -302,6 +302,8 @@ db_inputchar(int c)
db_history_last = db_history;
}
*db_history_last++ = '\0';
+ if (db_history_last == db_history + db_history_size)
+ db_history_last = db_history;
}
db_history_curr = db_history_last;
#endif