Grow.c: Fix classic readlink() buffer overflow
The buffer passed on to readlink() needs to contain space for the terminating \0. See 'man 3 readlink' for details. Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com> Signed-off-by: NeilBrown <neilb@suse.de>
This commit is contained in:
parent
7a862a020f
commit
9eb5ce5ae2
2
Grow.c
2
Grow.c
|
@ -3319,7 +3319,7 @@ started:
|
||||||
bul = make_backup(sra->sys_name);
|
bul = make_backup(sra->sys_name);
|
||||||
if (bul) {
|
if (bul) {
|
||||||
char buf[1024];
|
char buf[1024];
|
||||||
int l = readlink(bul, buf, sizeof(buf));
|
int l = readlink(bul, buf, sizeof(buf) - 1);
|
||||||
if (l > 0) {
|
if (l > 0) {
|
||||||
buf[l]=0;
|
buf[l]=0;
|
||||||
unlink(buf);
|
unlink(buf);
|
||||||
|
|
Loading…
Reference in New Issue