mirror of
https://github.com/git/git.git
synced 2026-02-19 14:21:50 +00:00
Merge branch 'jm/maint-strncpy-diff-no-index' into next
Will merge to 'next'. By Jim Meyering * jm/maint-strncpy-diff-no-index: diff: avoid stack-buffer-read-overrun for very long name
This commit is contained in:
@@ -109,6 +109,7 @@ static int queue_diff(struct diff_options *o,
|
||||
n1 = buffer1;
|
||||
strncpy(buffer1 + len1, p1.items[i1++].string,
|
||||
PATH_MAX - len1);
|
||||
buffer1[PATH_MAX-1] = 0;
|
||||
}
|
||||
|
||||
if (comp < 0)
|
||||
@@ -117,6 +118,7 @@ static int queue_diff(struct diff_options *o,
|
||||
n2 = buffer2;
|
||||
strncpy(buffer2 + len2, p2.items[i2++].string,
|
||||
PATH_MAX - len2);
|
||||
buffer2[PATH_MAX-1] = 0;
|
||||
}
|
||||
|
||||
ret = queue_diff(o, n1, n2);
|
||||
|
||||
Reference in New Issue
Block a user