Skip to content

Commit ef0e938

Browse files
committed
Sync with 2.3.9
2 parents 8545932 + ecad27c commit ef0e938

File tree

7 files changed

+49
-26
lines changed

7 files changed

+49
-26
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/git.txt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,10 @@ Documentation for older releases are available here:
5656
link:RelNotes/2.4.1.txt[2.4.1],
5757
link:RelNotes/2.4.0.txt[2.4].
5858

59-
* link:v2.3.8/git.html[documentation for release 2.3.8]
59+
* link:v2.3.9/git.html[documentation for release 2.3.9]
6060

6161
* release notes for
62+
link:RelNotes/2.3.9.txt[2.3.9],
6263
link:RelNotes/2.3.8.txt[2.3.8],
6364
link:RelNotes/2.3.7.txt[2.3.7],
6465
link:RelNotes/2.3.6.txt[2.3.6],
@@ -69,9 +70,10 @@ Documentation for older releases are available here:
6970
link:RelNotes/2.3.1.txt[2.3.1],
7071
link:RelNotes/2.3.0.txt[2.3].
7172

72-
* link:v2.2.2/git.html[documentation for release 2.2.2]
73+
* link:v2.2.3/git.html[documentation for release 2.2.3]
7374

7475
* release notes for
76+
link:RelNotes/2.2.3.txt[2.2.3],
7577
link:RelNotes/2.2.2.txt[2.2.2],
7678
link:RelNotes/2.2.1.txt[2.2.1],
7779
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
@@ -723,7 +723,6 @@ int cmd_show_branch(int ac, const char **av, const char *prefix)
723723

724724
if (reflog) {
725725
unsigned char sha1[20];
726-
char nth_desc[256];
727726
char *ref;
728727
int base = 0;
729728
unsigned int flags = 0;
@@ -762,6 +761,7 @@ int cmd_show_branch(int ac, const char **av, const char *prefix)
762761

763762
for (i = 0; i < reflog; i++) {
764763
char *logmsg;
764+
char *nth_desc;
765765
const char *msg;
766766
unsigned long timestamp;
767767
int tz;
@@ -780,8 +780,10 @@ int cmd_show_branch(int ac, const char **av, const char *prefix)
780780
show_date(timestamp, tz, 1),
781781
msg);
782782
free(logmsg);
783-
sprintf(nth_desc, "%s@{%d}", *av, base+i);
783+
784+
nth_desc = xstrfmt("%s@{%d}", *av, base+i);
784785
append_ref(nth_desc, sha1, 1);
786+
free(nth_desc);
785787
}
786788
free(ref);
787789
}

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
@@ -1434,15 +1434,18 @@ static int verify_absent_1(const struct cache_entry *ce,
14341434
if (!len)
14351435
return 0;
14361436
else if (len > 0) {
1437-
char path[PATH_MAX + 1];
1438-
memcpy(path, ce->name, len);
1439-
path[len] = 0;
1437+
char *path;
1438+
int ret;
1439+
1440+
path = xmemdupz(ce->name, len);
14401441
if (lstat(path, &st))
1441-
return error("cannot stat '%s': %s", path,
1442+
ret = error("cannot stat '%s': %s", path,
14421443
strerror(errno));
1443-
1444-
return check_ok_to_remove(path, len, DT_UNKNOWN, NULL, &st,
1445-
error_type, o);
1444+
else
1445+
ret = check_ok_to_remove(path, len, DT_UNKNOWN, NULL,
1446+
&st, error_type, o);
1447+
free(path);
1448+
return ret;
14461449
} else if (lstat(ce->name, &st)) {
14471450
if (errno != ENOENT)
14481451
return error("cannot stat '%s': %s", ce->name,

0 commit comments

Comments
 (0)