1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@914 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
eban 2000-08-30 05:34:05 +00:00
parent 91f513b52a
commit db3e830f84
3 changed files with 32 additions and 6 deletions

View file

@ -7,6 +7,9 @@ Wed Aug 30 11:31:47 2000 Nobuyoshi Nakada <nobu.nakada@nifty.ne.jp>
* ext/Win32API/Win32API.c (Win32API_initialize): add the * ext/Win32API/Win32API.c (Win32API_initialize): add the
arguments checking. arguments checking.
* ext/Win32API/Win32API.c (Win32API_initialize): add taint
checking. allow String object in the third argument.
Wed Aug 30 10:29:40 2000 Masahiro Tomita <tommy@tmtm.org> Wed Aug 30 10:29:40 2000 Masahiro Tomita <tommy@tmtm.org>
* io.c (rb_f_p): flush output buffer. * io.c (rb_f_p): flush output buffer.

View file

@ -48,10 +48,13 @@ Win32API_initialize(self, dllname, proc, import, export)
VALUE str; VALUE str;
VALUE a_import; VALUE a_import;
VALUE *ptr; VALUE *ptr;
char *s;
int i; int i;
int len; int len;
int ex; int ex;
Check_SafeStr(dllname);
Check_SafeStr(proc);
hdll = LoadLibrary(RSTRING(dllname)->ptr); hdll = LoadLibrary(RSTRING(dllname)->ptr);
if (!hdll) if (!hdll)
rb_raise(rb_eRuntimeError, "LoadLibrary: %s\n", RSTRING(dllname)->ptr); rb_raise(rb_eRuntimeError, "LoadLibrary: %s\n", RSTRING(dllname)->ptr);
@ -70,11 +73,13 @@ Win32API_initialize(self, dllname, proc, import, export)
rb_iv_set(self, "__proc__", UINT2NUM((unsigned long)hproc)); rb_iv_set(self, "__proc__", UINT2NUM((unsigned long)hproc));
a_import = rb_ary_new(); a_import = rb_ary_new();
if (!NIL_P(import)) { switch (TYPE(import)) {
Check_Type(import, T_ARRAY); case T_NIL:
break;
case T_ARRAY:
ptr = RARRAY(import)->ptr; ptr = RARRAY(import)->ptr;
for (i = 0, len = RARRAY(import)->len; i < len; i++) { for (i = 0, len = RARRAY(import)->len; i < len; i++) {
Check_Type(ptr[i], T_STRING); Check_SafeStr(ptr[i]);
switch (*(char *)RSTRING(ptr[i])->ptr) { switch (*(char *)RSTRING(ptr[i])->ptr) {
case 'N': case 'n': case 'L': case 'l': case 'N': case 'n': case 'L': case 'l':
rb_ary_push(a_import, INT2FIX(_T_NUMBER)); rb_ary_push(a_import, INT2FIX(_T_NUMBER));
@ -87,13 +92,31 @@ Win32API_initialize(self, dllname, proc, import, export)
break; break;
} }
} }
break;
default:
Check_SafeStr(import);
s = RSTRING(import)->ptr;
for (i = 0, len = RSTRING(import)->len; i < len; i++) {
switch (*s++) {
case 'N': case 'n': case 'L': case 'l':
rb_ary_push(a_import, INT2FIX(_T_NUMBER));
break;
case 'P': case 'p':
rb_ary_push(a_import, INT2FIX(_T_POINTER));
break;
case 'I': case 'i':
rb_ary_push(a_import, INT2FIX(_T_INTEGER));
break;
}
}
break;
} }
rb_iv_set(self, "__import__", a_import); rb_iv_set(self, "__import__", a_import);
if (NIL_P(export)) { if (NIL_P(export)) {
ex = _T_VOID; ex = _T_VOID;
} else { } else {
Check_Type(export, T_STRING); Check_SafeStr(export);
switch (*RSTRING(export)->ptr) { switch (*RSTRING(export)->ptr) {
case 'V': case 'v': case 'V': case 'v':
ex = _T_VOID; ex = _T_VOID;

View file

@ -1,4 +1,4 @@
#define RUBY_VERSION "1.6.0" #define RUBY_VERSION "1.6.0"
#define RUBY_RELEASE_DATE "2000-08-29" #define RUBY_RELEASE_DATE "2000-08-30"
#define RUBY_VERSION_CODE 160 #define RUBY_VERSION_CODE 160
#define RUBY_RELEASE_CODE 20000829 #define RUBY_RELEASE_CODE 20000830