mirror of
https://github.com/vim/vim.git
synced 2025-08-22 19:27:53 -04:00
patch 8.2.2793: MS-Windows: string literals are writable with MSVC
Problem: MS-Windows: string literals are writable with MSVC. Solution: Add the /GF compiler flag. Make mch_write() safer. (Ken Takata, closes #8133)
This commit is contained in:
parent
9ce47ec0b6
commit
d23f8bde5c
@ -489,7 +489,7 @@ CON_LIB = $(CON_LIB) /DELAYLOAD:comdlg32.dll /DELAYLOAD:ole32.dll DelayImp.lib
|
|||||||
#VIMRCLOC = somewhere
|
#VIMRCLOC = somewhere
|
||||||
#VIMRUNTIMEDIR = somewhere
|
#VIMRUNTIMEDIR = somewhere
|
||||||
|
|
||||||
CFLAGS = -c /W3 /nologo $(CVARS) -I. -Iproto -DHAVE_PATHDEF -DWIN32 \
|
CFLAGS = -c /W3 /GF /nologo $(CVARS) -I. -Iproto -DHAVE_PATHDEF -DWIN32 \
|
||||||
$(CSCOPE_DEFS) $(TERM_DEFS) $(SOUND_DEFS) $(NETBEANS_DEFS) $(CHANNEL_DEFS) \
|
$(CSCOPE_DEFS) $(TERM_DEFS) $(SOUND_DEFS) $(NETBEANS_DEFS) $(CHANNEL_DEFS) \
|
||||||
$(NBDEBUG_DEFS) $(XPM_DEFS) \
|
$(NBDEBUG_DEFS) $(XPM_DEFS) \
|
||||||
$(DEFINES) -DWINVER=$(WINVER) -D_WIN32_WINNT=$(WINVER)
|
$(DEFINES) -DWINVER=$(WINVER) -D_WIN32_WINNT=$(WINVER)
|
||||||
|
@ -6406,15 +6406,13 @@ mch_write(
|
|||||||
char_u *s,
|
char_u *s,
|
||||||
int len)
|
int len)
|
||||||
{
|
{
|
||||||
|
char_u *end = s + len;
|
||||||
|
|
||||||
# ifdef VIMDLL
|
# ifdef VIMDLL
|
||||||
if (gui.in_use)
|
if (gui.in_use)
|
||||||
return;
|
return;
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
// Avoid writing to a string literal.
|
|
||||||
if (s[len] != NUL)
|
|
||||||
s[len] = NUL;
|
|
||||||
|
|
||||||
if (!term_console)
|
if (!term_console)
|
||||||
{
|
{
|
||||||
write(1, s, (unsigned)len);
|
write(1, s, (unsigned)len);
|
||||||
@ -6435,10 +6433,13 @@ mch_write(
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
while ((ch = s[++prefix]))
|
while (s + ++prefix < end)
|
||||||
|
{
|
||||||
|
ch = s[prefix];
|
||||||
if (ch <= 0x1e && !(ch != '\n' && ch != '\r' && ch != '\b'
|
if (ch <= 0x1e && !(ch != '\n' && ch != '\r' && ch != '\b'
|
||||||
&& ch != '\a' && ch != '\033'))
|
&& ch != '\a' && ch != '\033'))
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
if (p_wd)
|
if (p_wd)
|
||||||
{
|
{
|
||||||
|
@ -750,6 +750,8 @@ static char *(features[]) =
|
|||||||
|
|
||||||
static int included_patches[] =
|
static int included_patches[] =
|
||||||
{ /* Add new patch number below this line */
|
{ /* Add new patch number below this line */
|
||||||
|
/**/
|
||||||
|
2793,
|
||||||
/**/
|
/**/
|
||||||
2792,
|
2792,
|
||||||
/**/
|
/**/
|
||||||
|
Loading…
x
Reference in New Issue
Block a user