summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard Jones <rjones@redhat.com>2009-04-24 14:31:38 +0100
committerRichard Jones <rjones@redhat.com>2009-04-24 14:31:38 +0100
commit56826a0dc9533cb1d7d227c5a2f70d8d31a4dd8f (patch)
treef40158759b30ed238da706956f54f913352dfeeb
parentab6f429a5a5ba084bdc948c0c21b2dceeae6298d (diff)
downloadlibguestfs-56826a0dc9533cb1d7d227c5a2f70d8d31a4dd8f.tar.gz
libguestfs-56826a0dc9533cb1d7d227c5a2f70d8d31a4dd8f.tar.xz
libguestfs-56826a0dc9533cb1d7d227c5a2f70d8d31a4dd8f.zip
Ruby bindings didn't NULL-terminate an array, resulting in segfault.1.0.12
-rw-r--r--ruby/ext/guestfs/_guestfs.c5
-rwxr-xr-xsrc/generator.ml1
2 files changed, 6 insertions, 0 deletions
diff --git a/ruby/ext/guestfs/_guestfs.c b/ruby/ext/guestfs/_guestfs.c
index 07b02287..d4b62cad 100644
--- a/ruby/ext/guestfs/_guestfs.c
+++ b/ruby/ext/guestfs/_guestfs.c
@@ -1418,6 +1418,7 @@ static VALUE ruby_guestfs_vgcreate (VALUE gv, VALUE volgroupv, VALUE physvolsv)
VALUE v = rb_ary_entry (physvolsv, i);
physvols[i] = StringValueCStr (v);
}
+ physvols[len] = NULL;
}
int r;
@@ -1503,6 +1504,7 @@ static VALUE ruby_guestfs_sfdisk (VALUE gv, VALUE devicev, VALUE cylsv, VALUE he
VALUE v = rb_ary_entry (linesv, i);
lines[i] = StringValueCStr (v);
}
+ lines[len] = NULL;
}
int r;
@@ -1659,6 +1661,7 @@ static VALUE ruby_guestfs_command (VALUE gv, VALUE argumentsv)
VALUE v = rb_ary_entry (argumentsv, i);
arguments[i] = StringValueCStr (v);
}
+ arguments[len] = NULL;
}
char *r;
@@ -1688,6 +1691,7 @@ static VALUE ruby_guestfs_command_lines (VALUE gv, VALUE argumentsv)
VALUE v = rb_ary_entry (argumentsv, i);
arguments[i] = StringValueCStr (v);
}
+ arguments[len] = NULL;
}
char **r;
@@ -2337,6 +2341,7 @@ static VALUE ruby_guestfs_debug (VALUE gv, VALUE subcmdv, VALUE extraargsv)
VALUE v = rb_ary_entry (extraargsv, i);
extraargs[i] = StringValueCStr (v);
}
+ extraargs[len] = NULL;
}
char *r;
diff --git a/src/generator.ml b/src/generator.ml
index 29b0ecd7..19ee71a3 100755
--- a/src/generator.ml
+++ b/src/generator.ml
@@ -5414,6 +5414,7 @@ static VALUE ruby_guestfs_close (VALUE gv)
pr " VALUE v = rb_ary_entry (%sv, i);\n" n;
pr " %s[i] = StringValueCStr (v);\n" n;
pr " }\n";
+ pr " %s[len] = NULL;\n" n;
pr " }\n";
| Bool n
| Int n ->