mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
Remove potential NULL dereference. #2316
This also removes the `#elseif defined(MSWIN)` clause. Due to the enclosing `if` block, we will never get to this point when src starts with a '%', making the whole #elseif block dead code.
This commit is contained in:
parent
7080041465
commit
d2c3592da1
@ -243,19 +243,16 @@ void expand_env_esc(char_u *srcp, char_u *dst, int dstlen, bool esc, bool one,
|
|||||||
// Verify that we have found the end of a UNIX ${VAR} style variable
|
// Verify that we have found the end of a UNIX ${VAR} style variable
|
||||||
if (src[1] == '{' && *tail != '}') {
|
if (src[1] == '{' && *tail != '}') {
|
||||||
var = NULL;
|
var = NULL;
|
||||||
} else if (src[1] == '{') {
|
} else {
|
||||||
++tail;
|
if (src[1] == '{') {
|
||||||
}
|
++tail;
|
||||||
#elif defined(MSWIN)
|
}
|
||||||
// Verify that we have found the end of a Windows %VAR% style variable
|
|
||||||
if (src[0] == '%' && *tail != '%') {
|
|
||||||
var = NULL;
|
|
||||||
} else if (src[0] == '%') {
|
|
||||||
++tail;
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
*var = NUL;
|
*var = NUL;
|
||||||
var = vim_getenv(dst, &mustfree);
|
var = vim_getenv(dst, &mustfree);
|
||||||
|
#if defined(UNIX)
|
||||||
|
}
|
||||||
|
#endif
|
||||||
} else if ( src[1] == NUL /* home directory */
|
} else if ( src[1] == NUL /* home directory */
|
||||||
|| vim_ispathsep(src[1])
|
|| vim_ispathsep(src[1])
|
||||||
|| vim_strchr((char_u *)" ,\t\n", src[1]) != NULL) {
|
|| vim_strchr((char_u *)" ,\t\n", src[1]) != NULL) {
|
||||||
|
Loading…
Reference in New Issue
Block a user