Skip to content

Commit 630ab6a

Browse files
authored
Fix #253 (#254)
1 parent dde4aae commit 630ab6a

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

peglib.h

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4797,22 +4797,23 @@ inline void enable_profiling(parser &parser, std::ostream &os) {
47974797
<< std::endl;
47984798

47994799
auto grand_total = total_success + total_fail;
4800-
sprintf(buff, "%4s %10zu %5s %10zu %10zu %s", "", grand_total,
4801-
"", total_success, total_fail, "Total counters");
4800+
snprintf(buff, BUFSIZ, "%4s %10zu %5s %10zu %10zu %s", "",
4801+
grand_total, "", total_success, total_fail,
4802+
"Total counters");
48024803
os << buff << std::endl;
48034804

4804-
sprintf(buff, "%4s %10s %5s %10.2f %10.2f %s", "", "", "",
4805-
total_success * 100.0 / grand_total,
4806-
total_fail * 100.0 / grand_total, "% success/fail");
4805+
snprintf(buff, BUFSIZ, "%4s %10s %5s %10.2f %10.2f %s", "",
4806+
"", "", total_success * 100.0 / grand_total,
4807+
total_fail * 100.0 / grand_total, "% success/fail");
48074808
os << buff << std::endl << std::endl;
48084809
;
48094810

48104811
size_t id = 0;
48114812
for (auto &[name, success, fail] : stats.items) {
48124813
auto total = success + fail;
48134814
auto ratio = total * 100.0 / stats.total;
4814-
sprintf(buff, "%4zu %10zu %5.2f %10zu %10zu %s", id, total,
4815-
ratio, success, fail, name.c_str());
4815+
snprintf(buff, BUFSIZ, "%4zu %10zu %5.2f %10zu %10zu %s",
4816+
id, total, ratio, success, fail, name.c_str());
48164817
os << buff << std::endl;
48174818
id++;
48184819
}

0 commit comments

Comments
 (0)