mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
coverity/133853: Out-of-bounds access
This commit is contained in:
parent
d97d66e173
commit
6c467f3f7e
@ -381,20 +381,17 @@ static int other_sourcing_name(void)
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/// Get the message about the source, as used for an error message.
|
||||||
* Get the message about the source, as used for an error message.
|
/// Returns an allocated string with room for one more character.
|
||||||
* Returns an allocated string with room for one more character.
|
/// Returns NULL when no message is to be given.
|
||||||
* Returns NULL when no message is to be given.
|
|
||||||
*/
|
|
||||||
static char_u *get_emsg_source(void)
|
static char_u *get_emsg_source(void)
|
||||||
{
|
{
|
||||||
char_u *Buf, *p;
|
|
||||||
|
|
||||||
if (sourcing_name != NULL && other_sourcing_name()) {
|
if (sourcing_name != NULL && other_sourcing_name()) {
|
||||||
p = (char_u *)_("Error detected while processing %s:");
|
char_u *p = (char_u *)_("Error detected while processing %s:");
|
||||||
Buf = xmalloc(STRLEN(sourcing_name) + STRLEN(p));
|
size_t len = STRLEN(sourcing_name) + STRLEN(p) + 1;
|
||||||
sprintf((char *)Buf, (char *)p, sourcing_name);
|
char_u *buf = xmalloc(len);
|
||||||
return Buf;
|
snprintf((char *)buf, len, (char *)p, sourcing_name);
|
||||||
|
return buf;
|
||||||
}
|
}
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user