From 2ba6eec1fa50cacaff647525358fd93c7c862a27 Mon Sep 17 00:00:00 2001 From: akr Date: Sat, 28 Feb 2009 09:29:26 +0000 Subject: * ext/socket/ancdata.c (ancillary_unix_rights): check message type. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22676 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ext/socket/ancdata.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'ext') diff --git a/ext/socket/ancdata.c b/ext/socket/ancdata.c index 204f745314..9d1ab95c1f 100644 --- a/ext/socket/ancdata.c +++ b/ext/socket/ancdata.c @@ -254,6 +254,14 @@ static VALUE ancillary_unix_rights(VALUE self) { #ifdef SCM_RIGHTS + int level, type; + + level = ancillary_level(self); + type = ancillary_type(self); + + if (level != SOL_SOCKET || type != SCM_RIGHTS) + rb_raise(rb_eTypeError, "SCM_RIGHTS ancillary data expected"); + VALUE v = rb_attr_get(self, rb_intern("unix_rights")); return v; #else -- cgit v1.2.3