diff options
author | Philip Kelley <phkelley@hotmail.com> | 2012-10-14 20:29:05 +0400 |
---|---|---|
committer | Philip Kelley <phkelley@hotmail.com> | 2012-10-14 20:29:05 +0400 |
commit | 9d9288f417968a7fd583786a749c4f7dfa258f89 (patch) | |
tree | d89a8a1ffb12176938c2b513841345e15aeb5a60 /src/buffer.c | |
parent | 80a6e86bb626acbf19088a9c8e780ebf151cd040 (diff) |
Fix buffer overrun in git_buf_put_base64
Diffstat (limited to 'src/buffer.c')
-rw-r--r-- | src/buffer.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/buffer.c b/src/buffer.c index ee2dd2804..b40b16b66 100644 --- a/src/buffer.c +++ b/src/buffer.c @@ -195,7 +195,7 @@ int git_buf_put_base64(git_buf *buf, const char *data, size_t len) uint8_t *write, a, b, c; const uint8_t *read = (const uint8_t *)data; - ENSURE_SIZE(buf, buf->size + ((len * 4 + 3) / 3) + 1); + ENSURE_SIZE(buf, buf->size + 4 * ((len / 3) + !!extra) + 1); write = (uint8_t *)&buf->ptr[buf->size]; /* convert each run of 3 bytes into 4 output bytes */ |