Skip to content

Commit 32d9c0e

Browse files
hanwengitster
authored andcommitted
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>
1 parent 4e26066 commit 32d9c0e

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

reftable/record.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,7 @@ static void hex_format(char *dest, uint8_t *src, int hash_size)
254254
void reftable_ref_record_print(struct reftable_ref_record *ref,
255255
uint32_t hash_id)
256256
{
257-
char hex[2 * GIT_SHA256_RAWSZ + 1] = { 0 }; /* BUG */
257+
char hex[GIT_MAX_HEXSZ + 1] = { 0 }; /* BUG */
258258
printf("ref{%s(%" PRIu64 ") ", ref->refname, ref->update_index);
259259
switch (ref->value_type) {
260260
case REFTABLE_REF_SYMREF:
@@ -586,7 +586,7 @@ static struct reftable_record_vtable reftable_obj_record_vtable = {
586586
void reftable_log_record_print(struct reftable_log_record *log,
587587
uint32_t hash_id)
588588
{
589-
char hex[GIT_SHA256_RAWSZ + 1] = { 0 };
589+
char hex[GIT_MAX_HEXSZ + 1] = { 0 };
590590

591591
switch (log->value_type) {
592592
case REFTABLE_LOG_DELETION:

0 commit comments

Comments
 (0)