Skip to content

Commit a9680e7

Browse files
Fix for strcat
Signed-off-by: Guillaume Mercier <[email protected]>
1 parent 1754414 commit a9680e7

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/qvi-hwloc.cc

+4-4
Original file line numberDiff line numberDiff line change
@@ -846,13 +846,13 @@ qvi_hwloc_bitmap_asprintf(
846846
if (topo) {
847847
int num_pus = hwloc_get_nbobjs_inside_cpuset_by_type(topo, cpuset, HWLOC_OBJ_PU);
848848
hwloc_obj_t obj_pu = NULL;
849-
char str[64] = {0};
849+
char str[128] = {0};
850850
sprintf(str,"%s"," | cpubind (logical)=[");
851851
for(int idx = 0; idx < num_pus ; idx++){
852852
char str2[64] = {0};
853853
obj_pu = hwloc_get_next_obj_inside_cpuset_by_type(topo, cpuset, HWLOC_OBJ_PU, obj_pu);
854854
sprintf(str2,"%i%s",obj_pu->logical_index, idx == (num_pus-1) ? "]" :",");
855-
strncat(str,str2,strlen(str2));
855+
strcat(str,str2);
856856
}
857857

858858
char *newstr = (char *)malloc(sizeof(char)*(strlen(str)+strlen(iresult)+1));
@@ -882,13 +882,13 @@ qvi_hwloc_bitmap_list_asprintf(
882882
if (topo) {
883883
int num_pus = hwloc_get_nbobjs_inside_cpuset_by_type(topo, cpuset, HWLOC_OBJ_PU);
884884
hwloc_obj_t obj_pu = NULL;
885-
char str[64] = {0};
885+
char str[128] = {0};
886886
sprintf(str,"%s"," | cpubind (logical)=[");
887887
for(int idx = 0; idx < num_pus ; idx++){
888888
char str2[64] = {0};
889889
obj_pu = hwloc_get_next_obj_inside_cpuset_by_type(topo, cpuset, HWLOC_OBJ_PU, obj_pu);
890890
sprintf(str2,"%i%s",obj_pu->logical_index, idx == (num_pus-1) ? "]" :",");
891-
strncat(str,str2,strlen(str2));
891+
strcat(str,str2);
892892
}
893893

894894
char *newstr = (char *)malloc(sizeof(char)*(strlen(str)+strlen(iresult)+1));

0 commit comments

Comments
 (0)