Web lists-archives.com

Re: [PATCH 07/17] commit: increase commit message buffer size




On 7/8/2018 7:36 PM, brian m. carlson wrote:
100 bytes is not sufficient to ensure we can write a commit message
buffer when using a 32-byte hash algorithm.  Increase the buffer size to
ensure we have sufficient space.

Signed-off-by: brian m. carlson <sandals@xxxxxxxxxxxxxxxxxxxx>
---
  refs/files-backend.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/refs/files-backend.c b/refs/files-backend.c
index a9a066dcfb..252f835bae 100644
--- a/refs/files-backend.c
+++ b/refs/files-backend.c
@@ -1587,7 +1587,7 @@ static int log_ref_write_fd(int fd, const struct object_id *old_oid,
  	char *logrec;
msglen = msg ? strlen(msg) : 0;
-	maxlen = strlen(committer) + msglen + 100;
+	maxlen = strlen(committer) + msglen + 200;
  	logrec = xmalloc(maxlen);
  	len = xsnprintf(logrec, maxlen, "%s %s %s\n",
  			oid_to_hex(old_oid),

nit: 100 is not enough anymore, but wasn't a very descriptive value. 200 may be enough now, but I'm not sure why.

Thanks,
-Stolee