xchat-ruby/xchat-ruby-1.2-fix-null-ptr-deref.diff

20 lines
823 B
Diff

--- xchat-ruby-1.2-src/src/xchat-ruby.c.orig 2007-04-26 13:16:32.000000000 +0200
+++ xchat-ruby-1.2-src/src/xchat-ruby.c 2012-02-03 21:01:12.779969703 +0100
@@ -773,7 +773,7 @@ static int static_ruby_custom_command_ho
rb_word = rb_ary_new();
rb_word_eol = rb_ary_new();
- for( i = 1; word[i][0] != '\0'; i++ )
+ for( i = 1; word[i] && word[i][0] != '\0'; i++ )
{
rb_ary_push( rb_word, rb_str_new2( word[i] ) );
rb_ary_push( rb_word_eol, rb_str_new2( word_eol[i] ) );
@@ -828,7 +828,7 @@ static int static_ruby_custom_server_hoo
rb_word = rb_ary_new();
rb_word_eol = rb_ary_new();
- for( i = 1; word[i][0] != '\0'; i++ )
+ for( i = 1; word[i] && word[i][0] != '\0'; i++ )
{
rb_ary_push( rb_word, rb_str_new2( word[i] ) );
rb_ary_push( rb_word_eol, rb_str_new2( word_eol[i] ) );