To: vim_dev@googlegroups.com Subject: Patch 7.3.267 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 7.3.267 Problem: Ruby on Mac OS X 10.7 may crash. Solution: Avoid alloc(0). (Bjorn Winckler) Files: src/if_ruby.c *** ../vim-7.3.266/src/if_ruby.c 2011-01-17 19:53:20.000000000 +0100 --- src/if_ruby.c 2011-08-04 18:57:43.000000000 +0200 *************** *** 761,771 **** char *buff, *p; str = rb_obj_as_string(str); ! buff = ALLOCA_N(char, RSTRING_LEN(str)); ! strcpy(buff, RSTRING_PTR(str)); ! p = strchr(buff, '\n'); ! if (p) *p = '\0'; ! MSG(buff); return Qnil; } --- 761,779 ---- char *buff, *p; str = rb_obj_as_string(str); ! if (RSTRING_LEN(str) > 0) ! { ! /* Only do this when the string isn't empty, alloc(0) causes trouble. */ ! buff = ALLOCA_N(char, RSTRING_LEN(str)); ! strcpy(buff, RSTRING_PTR(str)); ! p = strchr(buff, '\n'); ! if (p) *p = '\0'; ! MSG(buff); ! } ! else ! { ! MSG(""); ! } return Qnil; } *** ../vim-7.3.266/src/version.c 2011-07-27 18:25:40.000000000 +0200 --- src/version.c 2011-08-04 19:07:45.000000000 +0200 *************** *** 711,712 **** --- 711,714 ---- { /* Add new patch number below this line */ + /**/ + 267, /**/ -- There are 10 kinds of people: Those who understand binary and those who don't. /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\ an exciting new programming language -- http://www.Zimbu.org /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///