0
0
mirror of https://github.com/vim/vim.git synced 2025-07-26 11:04:33 -04:00

patch 9.0.2033: gcc overflow-warning for f_resolve

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>
This commit is contained in:
Ken Takata 2023-10-16 09:57:43 +02:00 committed by Christian Brabandt
parent dbf749bd5a
commit 215c3261a2
No known key found for this signature in database
GPG Key ID: F3F92DA383FDDE09
2 changed files with 3 additions and 1 deletions

View 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))

View File

@ -704,6 +704,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
2033,
/**/
2032,
/**/