- sprintf(buf + ami_cnt, " thread=%lu, file=%s, line=%d, info=\"",
- tid.ltid, amip->file, amip->line);
- buf_len = strlen(buf);
+ n = BIO_snprintf(buf + ami_cnt, sizeof(buf) - ami_cnt,
+ " thread=%lu, file=%s, line=%d, info=\"",
+ tid.ltid, amip->file, amip->line);
+ if (n <= 0)
+ break;
+ buf_len = ami_cnt + n;