summaryrefslogtreecommitdiff
path: root/builtin
diff options
context:
space:
mode:
authorLibravatar Junio C Hamano <gitster@pobox.com>2013-04-03 08:35:06 -0700
committerLibravatar Junio C Hamano <gitster@pobox.com>2013-04-03 08:35:06 -0700
commitf4254d1fb209b1955394ec4a74d1a8a5935ad7c3 (patch)
treea04a9c7dbb446a0ebf659901d84ceae8121d0039 /builtin
parentgit-tag(1): we tag HEAD by default (diff)
parentindex-pack: fix buffer overflow caused by translations (diff)
downloadtgif-f4254d1fb209b1955394ec4a74d1a8a5935ad7c3.tar.xz
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
Diffstat (limited to 'builtin')
-rw-r--r--builtin/index-pack.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/builtin/index-pack.c b/builtin/index-pack.c
index 43d364b8d5..ef62124aa4 100644
--- a/builtin/index-pack.c
+++ b/builtin/index-pack.c
@@ -1099,7 +1099,7 @@ static void conclude_pack(int fix_thin_pack, const char *curr_pack, unsigned cha
if (fix_thin_pack) {
struct sha1file *f;
unsigned char read_sha1[20], tail_sha1[20];
- char msg[48];
+ struct strbuf msg = STRBUF_INIT;
int nr_unresolved = nr_deltas - nr_resolved_deltas;
int nr_objects_initial = nr_objects;
if (nr_unresolved <= 0)
@@ -1109,9 +1109,10 @@ static void conclude_pack(int fix_thin_pack, const char *curr_pack, unsigned cha
* sizeof(*objects));
f = sha1fd(output_fd, curr_pack);
fix_unresolved_deltas(f, nr_unresolved);
- sprintf(msg, _("completed with %d local objects"),
- nr_objects - nr_objects_initial);
- stop_progress_msg(&progress, msg);
+ strbuf_addf(&msg, _("completed with %d local objects"),
+ nr_objects - nr_objects_initial);
+ stop_progress_msg(&progress, msg.buf);
+ strbuf_release(&msg);
sha1close(f, tail_sha1, 0);
hashcpy(read_sha1, pack_sha1);
fixup_pack_header_footer(output_fd, pack_sha1,