Skip to content

Commit a29523d

Browse files
committed
usnic: ensure that stats string is always truncated
Signed-off-by: Jeff Squyres <[email protected]> (cherry picked from commit 706f53b)
1 parent c403609 commit a29523d

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

ompi/mca/btl/usnic/btl_usnic_stats.c

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

122122
module->stats.num_crc_errors);
123123

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

0 commit comments

Comments
 (0)