Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHan-Wen Nienhuys <hanwen@google.com>2022-01-20 18:12:00 +0300
committerJunio C Hamano <gitster@pobox.com>2022-01-20 22:31:52 +0300
commit32d9c0ed1e9d7ebb539dcc8ec573c025a49b9936 (patch)
tree3e0e710e256c0cadca59b7d536330c6b87386947 /reftable
parent4e26066009ef3d4e725da075f1bed39630e4da9f (diff)
reftable: fix OOB stack write in print functions
Signed-off-by: Han-Wen Nienhuys <hanwen@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'reftable')
-rw-r--r--reftable/record.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/reftable/record.c b/reftable/record.c
index 6a5dac32dc..8536bd03aa 100644
--- a/reftable/record.c
+++ b/reftable/record.c
@@ -254,7 +254,7 @@ static void hex_format(char *dest, uint8_t *src, int hash_size)
void reftable_ref_record_print(struct reftable_ref_record *ref,
uint32_t hash_id)
{
- char hex[2 * GIT_SHA256_RAWSZ + 1] = { 0 }; /* BUG */
+ char hex[GIT_MAX_HEXSZ + 1] = { 0 }; /* BUG */
printf("ref{%s(%" PRIu64 ") ", ref->refname, ref->update_index);
switch (ref->value_type) {
case REFTABLE_REF_SYMREF:
@@ -586,7 +586,7 @@ static struct reftable_record_vtable reftable_obj_record_vtable = {
void reftable_log_record_print(struct reftable_log_record *log,
uint32_t hash_id)
{
- char hex[GIT_SHA256_RAWSZ + 1] = { 0 };
+ char hex[GIT_MAX_HEXSZ + 1] = { 0 };
switch (log->value_type) {
case REFTABLE_LOG_DELETION: