Skip to content

Commit

Permalink
log: prevent stack smashing
Browse files Browse the repository at this point in the history
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
  • Loading branch information
Christian Brauner authored and stgraber committed Oct 17, 2017
1 parent 85d1047 commit 3eddc00
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/lxc/log.c
Expand Up @@ -297,7 +297,8 @@ static int log_append_logfile(const struct lxc_log_appender *appender,

if ((size_t)n < (sizeof(buffer) - 1))
n += vsnprintf(buffer + n, sizeof(buffer) - n, event->fmt, *event->vap);
else

if ((size_t)n >= sizeof(buffer))
n = sizeof(buffer) - 1;

buffer[n] = '\n';
Expand Down

0 comments on commit 3eddc00

Please sign in to comment.