[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH] sed: fix handling of symlinks pointing to path with 128 chars
From: |
Hauke Mehrtens |
Subject: |
[PATCH] sed: fix handling of symlinks pointing to path with 128 chars |
Date: |
Sun, 18 Dec 2022 03:07:12 +0100 |
* sed/utils.c:
(follow_symlink): Expand buf if buf_used == buf_size to call readlink on
path of len(path) == SSIZE_IDX_MAX too.
---
NEWS | 3 +++
sed/utils.c | 2 +-
2 files changed, 4 insertions(+), 1 deletion(-)
diff --git a/NEWS b/NEWS
index c6adcda..95c64f5 100644
--- a/NEWS
+++ b/NEWS
@@ -2,6 +2,9 @@ GNU sed NEWS -*- outline -*-
* Noteworthy changes in release ?.? (????-??-??) [?]
+** Bug fixes
+ 'sed --follow-symlinks -i' works again on symlinks of 128 characters.
+ [bug introduced in sed 4.9]
* Noteworthy changes in release 4.9 (2022-11-06) [stable]
diff --git a/sed/utils.c b/sed/utils.c
index 4bd6587..905c96a 100644
--- a/sed/utils.c
+++ b/sed/utils.c
@@ -344,7 +344,7 @@ follow_symlink (const char *fname)
/* Put symlink contents into BUF + BUF_USED. */
while ((linklen = (buf_used < buf_size
? readlink (fn, buf + buf_used, buf_size - buf_used)
- : 0))
+ : buf_size))
== buf_size)
{
buf = xpalloc (buf, &buf_size, 1, SSIZE_IDX_MAX, 1);
--
2.35.1
- [PATCH] sed: fix handling of symlinks pointing to path with 128 chars,
Hauke Mehrtens <=