Skip to content

Commit 00ccf54

Browse files
committed
patch 8.0.1047: buffer overflow in Ruby
Problem: Buffer overflow in Ruby. Solution: Allocate one more byte. (Dominique Pelle)
1 parent ae96b8d commit 00ccf54

2 files changed

Lines changed: 3 additions & 1 deletion

File tree

src/if_ruby.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -984,7 +984,7 @@ static VALUE vim_message(VALUE self UNUSED, VALUE str)
984984
if (RSTRING_LEN(str) > 0)
985985
{
986986
/* Only do this when the string isn't empty, alloc(0) causes trouble. */
987-
buff = ALLOCA_N(char, RSTRING_LEN(str));
987+
buff = ALLOCA_N(char, RSTRING_LEN(str) + 1);
988988
strcpy(buff, RSTRING_PTR(str));
989989
p = strchr(buff, '\n');
990990
if (p) *p = '\0';

src/version.c

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

770770
static int included_patches[] =
771771
{ /* Add new patch number below this line */
772+
/**/
773+
1047,
772774
/**/
773775
1046,
774776
/**/

0 commit comments

Comments
 (0)