ruby-changes:38992
From: nobu <ko1@a...>
Date: Tue, 30 Jun 2015 23:12:17 +0900 (JST)
Subject: [ruby-changes:38992] nobu:r51073 (trunk): ensure paths NUL-terminated
nobu 2015-06-30 23:11:56 +0900 (Tue, 30 Jun 2015) New Revision: 51073 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=51073 Log: ensure paths NUL-terminated * dir.c (check_dirname): ensure path name NUL-terminated for SHARABLE_MIDDLE_SUBSTRING. * io.c (rb_sysopen): ditto. Modified files: trunk/ChangeLog trunk/dir.c trunk/io.c Index: ChangeLog =================================================================== --- ChangeLog (revision 51072) +++ ChangeLog (revision 51073) @@ -1,3 +1,10 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1 +Tue Jun 30 23:11:53 2015 Nobuyoshi Nakada <nobu@r...> + + * dir.c (check_dirname): ensure path name NUL-terminated for + SHARABLE_MIDDLE_SUBSTRING. + + * io.c (rb_sysopen): ditto. + Tue Jun 30 18:38:16 2015 NAKAMURA Usaku <usa@r...> * win32/file.c (rb_freopen): need to terminate by NUL. Index: io.c =================================================================== --- io.c (revision 51072) +++ io.c (revision 51073) @@ -5444,6 +5444,7 @@ rb_sysopen(VALUE fname, int oflags, mode https://github.com/ruby/ruby/blob/trunk/io.c#L5444 struct sysopen_struct data; data.fname = rb_str_encode_ospath(fname); + StringValueCStr(data.fname); data.oflags = oflags; data.perm = perm; Index: dir.c =================================================================== --- dir.c (revision 51072) +++ dir.c (revision 51073) @@ -1019,6 +1019,7 @@ check_dirname(VALUE dir) https://github.com/ruby/ruby/blob/trunk/dir.c#L1019 pend = rb_enc_path_end(rb_enc_path_skip_prefix(path, pend, enc), pend, enc); if (pend - path < len) { d = rb_str_subseq(d, 0, pend - path); + StringValueCStr(d); } return rb_str_encode_ospath(d); } -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/