Skip to content

Commit

Permalink
OTP-8549 Fix out of bounds write in erts_get_cpu_topology()
Browse files Browse the repository at this point in the history
The runtime system crashed if fewer logical processors were found than
reported by sysconf( SC_NPROCESSORS_CONF).
  • Loading branch information
rickard-green authored and Erlang/OTP committed Mar 31, 2010
1 parent 88f67c0 commit 943ad16
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions erts/lib_src/common/erl_misc_utils.c
Original file line number Diff line number Diff line change
@@ -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%
*/

Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 943ad16

Please sign in to comment.