1
0
Fork 0
mirror of https://github.com/ossrs/srs.git synced 2025-03-09 15:49:59 +00:00

For #1229, fix the security risk in logger. 3.0.69

This commit is contained in:
winlin 2019-12-11 11:56:00 +08:00
parent ad70589347
commit 78da67e8d1
5 changed files with 36 additions and 4 deletions

View file

@ -192,7 +192,8 @@ void SrsFastLog::error(const char* tag, int context_id, const char* fmt, ...)
va_end(ap);
// add strerror() to error msg.
if (errno != 0) {
// Check size to avoid security issue https://github.com/ossrs/srs/issues/1229
if (errno != 0 && size < LOG_MAX_SIZE) {
size += snprintf(log_data + size, LOG_MAX_SIZE - size, "(%s)", strerror(errno));
}