Skip to content

Commit 215c326

Browse files
k-takatachrisbra
authored andcommitted
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 <[email protected]> Co-authored-by: Ken Takata <[email protected]>
1 parent dbf749b commit 215c326

2 files changed

Lines changed: 3 additions & 1 deletion

File tree

src/filepath.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2159,7 +2159,7 @@ f_resolve(typval_T *argvars, typval_T *rettv)
21592159
if (q > p && *q == NUL)
21602160
{
21612161
// Ignore trailing path separator.
2162-
q[-1] = NUL;
2162+
p[q - p - 1] = NUL;
21632163
q = gettail(p);
21642164
}
21652165
if (q > p && !mch_isFullName(buf))

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -704,6 +704,8 @@ static char *(features[]) =
704704

705705
static int included_patches[] =
706706
{ /* Add new patch number below this line */
707+
/**/
708+
2033,
707709
/**/
708710
2032,
709711
/**/

0 commit comments

Comments
 (0)