Skip to content

Commit f4254d1

Browse files
committed
Merge branch 'nd/index-pack-l10n-buf-overflow' into maint-1.8.1
* nd/index-pack-l10n-buf-overflow: index-pack: fix buffer overflow caused by translations
2 parents dd686cd + 5c3459f commit f4254d1

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

builtin/index-pack.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1099,7 +1099,7 @@ static void conclude_pack(int fix_thin_pack, const char *curr_pack, unsigned cha
10991099
if (fix_thin_pack) {
11001100
struct sha1file *f;
11011101
unsigned char read_sha1[20], tail_sha1[20];
1102-
char msg[48];
1102+
struct strbuf msg = STRBUF_INIT;
11031103
int nr_unresolved = nr_deltas - nr_resolved_deltas;
11041104
int nr_objects_initial = nr_objects;
11051105
if (nr_unresolved <= 0)
@@ -1109,9 +1109,10 @@ static void conclude_pack(int fix_thin_pack, const char *curr_pack, unsigned cha
11091109
* sizeof(*objects));
11101110
f = sha1fd(output_fd, curr_pack);
11111111
fix_unresolved_deltas(f, nr_unresolved);
1112-
sprintf(msg, _("completed with %d local objects"),
1113-
nr_objects - nr_objects_initial);
1114-
stop_progress_msg(&progress, msg);
1112+
strbuf_addf(&msg, _("completed with %d local objects"),
1113+
nr_objects - nr_objects_initial);
1114+
stop_progress_msg(&progress, msg.buf);
1115+
strbuf_release(&msg);
11151116
sha1close(f, tail_sha1, 0);
11161117
hashcpy(read_sha1, pack_sha1);
11171118
fixup_pack_header_footer(output_fd, pack_sha1,

0 commit comments

Comments
 (0)