mirror of
https://github.com/ossrs/srs.git
synced 2025-03-09 15:49:59 +00:00
For #1229: Check the return value of vsnprintf.
This commit is contained in:
parent
079ac107f0
commit
5ae495ab95
4 changed files with 94 additions and 32 deletions
|
@ -49,7 +49,7 @@ public:
|
|||
{
|
||||
static char buf[4096] = {0};
|
||||
int nbytes = vsnprintf(buf, sizeof(buf), fmt, vl);
|
||||
if (nbytes > 0) {
|
||||
if (nbytes > 0 && nbytes < sizeof(buf)) {
|
||||
// Srs log is always start with new line, replcae '\n' to '\0', make log easy to read.
|
||||
if (buf[nbytes - 1] == '\n') {
|
||||
buf[nbytes - 1] = '\0';
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue