]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
patch 9.0.2033: gcc overflow-warning for f_resolve v9.0.2033
authorKen Takata <kentkt@csc.jp>
Mon, 16 Oct 2023 07:57:43 +0000 (09:57 +0200)
committerChristian Brabandt <cb@256bit.org>
Mon, 16 Oct 2023 07:57:43 +0000 (09:57 +0200)
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 <cb@256bit.org>
Co-authored-by: Ken Takata <kentkt@csc.jp>
src/filepath.c
src/version.c

index c30d9bf82bd301623de54934ceaf7507630d65ba..1ea062386716e57204e4d9a84424471c9be42b5b 100644 (file)
@@ -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))
index 2e14a90bbaee86d17da9af799a915a7f4a24018c..761cdd5e27e2689b11d27cd840b17b6dbee6545d 100644 (file)
@@ -704,6 +704,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    2033,
 /**/
     2032,
 /**/