aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRickard Green <[email protected]>2010-03-31 11:31:07 +0000
committerErlang/OTP <[email protected]>2010-03-31 11:31:07 +0000
commit943ad16fa4b6335b6e170cc94fc7df9041ff4e47 (patch)
tree20290cfea9c3ba1e74a4954550f56b9a98fe5966
parent88f67c0c3869806d2ec4cec625c47a78fd770156 (diff)
downloadotp-943ad16fa4b6335b6e170cc94fc7df9041ff4e47.tar.gz
otp-943ad16fa4b6335b6e170cc94fc7df9041ff4e47.tar.bz2
otp-943ad16fa4b6335b6e170cc94fc7df9041ff4e47.zip
OTP-8549 Fix out of bounds write in erts_get_cpu_topology()
The runtime system crashed if fewer logical processors were found than reported by sysconf( SC_NPROCESSORS_CONF).
-rw-r--r--erts/lib_src/common/erl_misc_utils.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/erts/lib_src/common/erl_misc_utils.c b/erts/lib_src/common/erl_misc_utils.c
index 9c25d33a3c..f70db86960 100644
--- a/erts/lib_src/common/erl_misc_utils.c
+++ b/erts/lib_src/common/erl_misc_utils.c
@@ -1,19 +1,19 @@
/*
* %CopyrightBegin%
- *
- * Copyright Ericsson AB 2006-2009. All Rights Reserved.
- *
+ *
+ * Copyright Ericsson AB 2006-2010. All Rights Reserved.
+ *
* The contents of this file are subject to the Erlang Public License,
* Version 1.1, (the "License"); you may not use this file except in
* compliance with the License. You should have received a copy of the
* Erlang Public License along with this software. If not, it can be
* retrieved online at http://www.erlang.org/.
- *
+ *
* Software distributed under the License is distributed on an "AS IS"
* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
* the License for the specific language governing rights and limitations
* under the License.
- *
+ *
* %CopyrightEnd%
*/
@@ -373,8 +373,8 @@ erts_get_cpu_topology(erts_cpu_info_t *cpuinfo,
return 0;
memcpy((void *) topology,
(void *) cpuinfo->topology,
- cpuinfo->configured*sizeof(erts_cpu_topology_t));
- return cpuinfo->configured;
+ cpuinfo->topology_size*sizeof(erts_cpu_topology_t));
+ return cpuinfo->topology_size;
}
int