replace sprintf usage with snprintf Even though this specific usage is safe, it is, arguably, not great to be using sprintf in year 2024. snprintf is portable enough this days. Thanks goes to OSX headers that warn about sprintf loudly enough to be noticed.
diff --git a/src/malloc_extension.cc b/src/malloc_extension.cc index 5f2ec2c..c9819ba 100644 --- a/src/malloc_extension.cc +++ b/src/malloc_extension.cc
@@ -263,7 +263,7 @@ } char label[32]; - sprintf(label, "heap_v2/%d", sample_period); + snprintf(label, sizeof(label), "heap_v2/%d", sample_period); PrintHeader(writer, label, entries); for (void** entry = entries; Count(entry) != 0; entry += 3 + Depth(entry)) { PrintStackEntry(writer, entry);