Skip to content

Commit 3d3caf0

Browse files
committed
Sync with 2.4.9
2 parents fb8880d + 74b6763 commit 3d3caf0

File tree

8 files changed

+60
-27
lines changed

8 files changed

+60
-27
lines changed

Documentation/RelNotes/2.2.3.txt

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
Git v2.2.3 Release Notes
2+
========================
3+
4+
Fixes since v2.2.2
5+
------------------
6+
7+
* A handful of codepaths that used to use fixed-sized arrays to hold
8+
pathnames have been corrected to use strbuf and other mechanisms to
9+
allow longer pathnames without fearing overflows.

Documentation/RelNotes/2.3.9.txt

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
Git v2.3.9 Release Notes
2+
========================
3+
4+
Fixes since v2.3.8
5+
------------------
6+
7+
* A handful of codepaths that used to use fixed-sized arrays to hold
8+
pathnames have been corrected to use strbuf and other mechanisms to
9+
allow longer pathnames without fearing overflows.

Documentation/RelNotes/2.4.9.txt

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
Git v2.4.9 Release Notes
2+
========================
3+
4+
Fixes since v2.4.9
5+
------------------
6+
7+
* A handful of codepaths that used to use fixed-sized arrays to hold
8+
pathnames have been corrected to use strbuf and other mechanisms to
9+
allow longer pathnames without fearing overflows.

Documentation/git.txt

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,10 @@ Documentation for older releases are available here:
4949
link:RelNotes/2.5.1.txt[2.5.1],
5050
link:RelNotes/2.5.0.txt[2.5].
5151

52-
* link:v2.4.8/git.html[documentation for release 2.4.8]
52+
* link:v2.4.9/git.html[documentation for release 2.4.9]
5353

5454
* release notes for
55+
link:RelNotes/2.4.9.txt[2.4.9],
5556
link:RelNotes/2.4.8.txt[2.4.8],
5657
link:RelNotes/2.4.7.txt[2.4.7],
5758
link:RelNotes/2.4.6.txt[2.4.6],
@@ -62,9 +63,10 @@ Documentation for older releases are available here:
6263
link:RelNotes/2.4.1.txt[2.4.1],
6364
link:RelNotes/2.4.0.txt[2.4].
6465

65-
* link:v2.3.8/git.html[documentation for release 2.3.8]
66+
* link:v2.3.9/git.html[documentation for release 2.3.9]
6667

6768
* release notes for
69+
link:RelNotes/2.3.9.txt[2.3.9],
6870
link:RelNotes/2.3.8.txt[2.3.8],
6971
link:RelNotes/2.3.7.txt[2.3.7],
7072
link:RelNotes/2.3.6.txt[2.3.6],
@@ -75,9 +77,10 @@ Documentation for older releases are available here:
7577
link:RelNotes/2.3.1.txt[2.3.1],
7678
link:RelNotes/2.3.0.txt[2.3].
7779

78-
* link:v2.2.2/git.html[documentation for release 2.2.2]
80+
* link:v2.2.3/git.html[documentation for release 2.2.3]
7981

8082
* release notes for
83+
link:RelNotes/2.2.3.txt[2.2.3],
8184
link:RelNotes/2.2.2.txt[2.2.2],
8285
link:RelNotes/2.2.1.txt[2.2.1],
8386
link:RelNotes/2.2.0.txt[2.2].

builtin/show-branch.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -730,7 +730,6 @@ int cmd_show_branch(int ac, const char **av, const char *prefix)
730730

731731
if (reflog) {
732732
struct object_id oid;
733-
char nth_desc[256];
734733
char *ref;
735734
int base = 0;
736735
unsigned int flags = 0;
@@ -769,6 +768,7 @@ int cmd_show_branch(int ac, const char **av, const char *prefix)
769768

770769
for (i = 0; i < reflog; i++) {
771770
char *logmsg;
771+
char *nth_desc;
772772
const char *msg;
773773
unsigned long timestamp;
774774
int tz;
@@ -787,8 +787,10 @@ int cmd_show_branch(int ac, const char **av, const char *prefix)
787787
show_date(timestamp, tz, 1),
788788
msg);
789789
free(logmsg);
790-
sprintf(nth_desc, "%s@{%d}", *av, base+i);
790+
791+
nth_desc = xstrfmt("%s@{%d}", *av, base+i);
791792
append_ref(nth_desc, &oid, 1);
793+
free(nth_desc);
792794
}
793795
free(ref);
794796
}

notes.c

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -362,13 +362,14 @@ static int non_note_cmp(const struct non_note *a, const struct non_note *b)
362362
return strcmp(a->path, b->path);
363363
}
364364

365-
static void add_non_note(struct notes_tree *t, const char *path,
365+
/* note: takes ownership of path string */
366+
static void add_non_note(struct notes_tree *t, char *path,
366367
unsigned int mode, const unsigned char *sha1)
367368
{
368369
struct non_note *p = t->prev_non_note, *n;
369370
n = (struct non_note *) xmalloc(sizeof(struct non_note));
370371
n->next = NULL;
371-
n->path = xstrdup(path);
372+
n->path = path;
372373
n->mode = mode;
373374
hashcpy(n->sha1, sha1);
374375
t->prev_non_note = n;
@@ -482,17 +483,17 @@ static void load_subtree(struct notes_tree *t, struct leaf_node *subtree,
482483
* component.
483484
*/
484485
{
485-
char non_note_path[PATH_MAX];
486-
char *p = non_note_path;
486+
struct strbuf non_note_path = STRBUF_INIT;
487487
const char *q = sha1_to_hex(subtree->key_sha1);
488488
int i;
489489
for (i = 0; i < prefix_len; i++) {
490-
*p++ = *q++;
491-
*p++ = *q++;
492-
*p++ = '/';
490+
strbuf_addch(&non_note_path, *q++);
491+
strbuf_addch(&non_note_path, *q++);
492+
strbuf_addch(&non_note_path, '/');
493493
}
494-
strcpy(p, entry.path);
495-
add_non_note(t, non_note_path, entry.mode, entry.sha1);
494+
strbuf_addstr(&non_note_path, entry.path);
495+
add_non_note(t, strbuf_detach(&non_note_path, NULL),
496+
entry.mode, entry.sha1);
496497
}
497498
}
498499
free(buf);

sha1_file.c

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -377,15 +377,12 @@ void read_info_alternates(const char * relative_base, int depth)
377377
char *map;
378378
size_t mapsz;
379379
struct stat st;
380-
const char alt_file_name[] = "info/alternates";
381-
/* Given that relative_base is no longer than PATH_MAX,
382-
ensure that "path" has enough space to append "/", the
383-
file name, "info/alternates", and a trailing NUL. */
384-
char path[PATH_MAX + 1 + sizeof alt_file_name];
380+
char *path;
385381
int fd;
386382

387-
sprintf(path, "%s/%s", relative_base, alt_file_name);
383+
path = xstrfmt("%s/info/alternates", relative_base);
388384
fd = git_open_noatime(path);
385+
free(path);
389386
if (fd < 0)
390387
return;
391388
if (fstat(fd, &st) || (st.st_size == 0)) {

unpack-trees.c

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1441,15 +1441,18 @@ static int verify_absent_1(const struct cache_entry *ce,
14411441
if (!len)
14421442
return 0;
14431443
else if (len > 0) {
1444-
char path[PATH_MAX + 1];
1445-
memcpy(path, ce->name, len);
1446-
path[len] = 0;
1444+
char *path;
1445+
int ret;
1446+
1447+
path = xmemdupz(ce->name, len);
14471448
if (lstat(path, &st))
1448-
return error("cannot stat '%s': %s", path,
1449+
ret = error("cannot stat '%s': %s", path,
14491450
strerror(errno));
1450-
1451-
return check_ok_to_remove(path, len, DT_UNKNOWN, NULL, &st,
1452-
error_type, o);
1451+
else
1452+
ret = check_ok_to_remove(path, len, DT_UNKNOWN, NULL,
1453+
&st, error_type, o);
1454+
free(path);
1455+
return ret;
14531456
} else if (lstat(ce->name, &st)) {
14541457
if (errno != ENOENT)
14551458
return error("cannot stat '%s': %s", ce->name,

0 commit comments

Comments
 (0)