From 215c3261a25f7a99e8711a3b3c6158119c6aea9e Mon Sep 17 00:00:00 2001 From: Ken Takata Date: Mon, 16 Oct 2023 09:57:43 +0200 Subject: patch 9.0.2033: gcc overflow-warning for f_resolve MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Problem: gcc overflow-warning for f_resolve Solution: use pointer p instead of pointer q[-1] Suppress the following warning: ``` filepath.c: In function ‘f_resolve’: filepath.c:2162:27: warning: writing 1 byte into a region of size 0 [-Wstringop-overflow=] 2162 | q[-1] = NUL; ``` Closes: #13352 closes: #13353 Signed-off-by: Christian Brabandt Co-authored-by: Ken Takata --- src/filepath.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/filepath.c') diff --git a/src/filepath.c b/src/filepath.c index c30d9bf82b..1ea0623867 100644 --- a/src/filepath.c +++ b/src/filepath.c @@ -2159,7 +2159,7 @@ f_resolve(typval_T *argvars, typval_T *rettv) if (q > p && *q == NUL) { // Ignore trailing path separator. - q[-1] = NUL; + p[q - p - 1] = NUL; q = gettail(p); } if (q > p && !mch_isFullName(buf)) -- cgit v1.2.3