summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
authorshyouhei <shyouhei@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-05-22 15:08:43 +0000
committershyouhei <shyouhei@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-05-22 15:08:43 +0000
commitb77c7dc903ce92a543e433066cc62dc822b4a7a7 (patch)
tree8f68102abe34596cf13b17f421b68505116f0cfb /ext
parent1e8985a4c3dee808743670ecc3674106119847b3 (diff)
merge -c 12137
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8_6@12311 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext')
-rw-r--r--ext/socket/socket.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/ext/socket/socket.c b/ext/socket/socket.c
index b396687..4c23a1c 100644
--- a/ext/socket/socket.c
+++ b/ext/socket/socket.c
@@ -625,7 +625,7 @@ s_recvfrom(sock, argc, argv, from)
rb_raise(rb_eTypeError, "sockaddr size differs - should not happen");
}
#endif
- if (alen) /* OSX doesn't return a 'from' result from recvfrom for connection-oriented sockets */
+ if (alen && alen != sizeof(buf)) /* OSX doesn't return a 'from' result from recvfrom for connection-oriented sockets */
return rb_assoc_new(str, ipaddr((struct sockaddr*)buf));
else
return rb_assoc_new(str, Qnil);
@@ -691,7 +691,7 @@ s_recvfrom_nonblock(VALUE sock, int argc, VALUE *argv, enum sock_recv_type from)
return str;
case RECV_IP:
- if (alen) /* connection-oriented socket may not return a from result */
+ if (alen && alen != sizeof(buf)) /* connection-oriented socket may not return a from result */
addr = ipaddr((struct sockaddr*)buf);
break;