Skip to content

Commit

Permalink
librlist: fix incorrect size passed to hwloc_topology_set_xmlbuffer
Browse files Browse the repository at this point in the history
Problem: When an hwloc topology is initialized from XML in rhwloc.c,
the size of the entire XML buffer include the terminating NUL character
is passed to hwloc_topology_topology_set_xmlbuffer(). This causes hwloc
to return an error with errno set to EINVAL with hwloc version 2.9.3.

Passing the XML string length instead of the buffer size does not
appear to cause any issues on previous hwloc versions, so just do that.
  • Loading branch information
grondo committed Jan 17, 2024
1 parent 0573d5f commit 3824a69
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/common/librlist/rhwloc.c
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ static int init_topo_from_xml (hwloc_topology_t *tp,
unsigned long flags)
{
if ((topo_init_common (tp, flags) < 0)
|| (hwloc_topology_set_xmlbuffer (*tp, xml, strlen (xml) + 1) < 0)
|| (hwloc_topology_set_xmlbuffer (*tp, xml, strlen (xml)) < 0)
|| (hwloc_topology_load (*tp) < 0)) {
hwloc_topology_destroy (*tp);
return (-1);
Expand Down

0 comments on commit 3824a69

Please sign in to comment.