summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authoranton <anton@cvs.openbsd.org>2019-02-15 18:33:45 +0000
committeranton <anton@cvs.openbsd.org>2019-02-15 18:33:45 +0000
commit721fcbe9568ffc0d3cdf342b263d3b78de075b74 (patch)
tree74272c2b70c90875cca9018b84e2454d62409019 /sys
parentdcca27ace36d0de4368860c1435c5662ae7c5b4f (diff)
The underlying storage for builtin ddb variables are of type int but
referenced to using a pointer to long. When writing to such a variable, cast it to the correct type. Writing would otherwise on 64-bit architectures cause the next variable adjacent in memory to also be modified. ok deraadt@ visa@
Diffstat (limited to 'sys')
-rw-r--r--sys/ddb/db_variables.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/sys/ddb/db_variables.c b/sys/ddb/db_variables.c
index 3e3f41b3ac7..2e55de16e65 100644
--- a/sys/ddb/db_variables.c
+++ b/sys/ddb/db_variables.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: db_variables.c,v 1.18 2016/01/25 14:30:30 mpi Exp $ */
+/* $OpenBSD: db_variables.c,v 1.19 2019/02/15 18:33:44 anton Exp $ */
/* $NetBSD: db_variables.c,v 1.8 1996/02/05 01:57:19 christos Exp $ */
/*
@@ -163,7 +163,7 @@ db_var_rw_int(struct db_variable *var, db_expr_t *expr, int mode)
{
if (mode == DB_VAR_SET)
- *var->valuep = *(int *)expr;
+ *(int *)var->valuep = *expr;
else
*expr = *(int *)var->valuep;
return (0);