Skip to content

Commit 706f53b

Browse files
committed
usnic: ensure that stats string is always truncated
Signed-off-by: Jeff Squyres <[email protected]>
1 parent 1fdd0fe commit 706f53b

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

opal/mca/btl/usnic/btl_usnic_stats.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,11 @@ void opal_btl_usnic_print_stats(
123123

124124
module->stats.num_crc_errors);
125125

126+
// Shouldn't happen, but just in case the string ever grows long
127+
// enough to someday potentially get truncated by snprintf, ensure
128+
// that the string is terminated.
129+
str[sizeof(str) - 1] = '\0';
130+
126131
/* If our PML calls were 0, then show send and receive window
127132
extents instead */
128133
if (module->stats.pml_module_sends +

0 commit comments

Comments
 (0)