* ext/socket/socket.c (init_unixsock): path may contain NUL for

abstract unix sockets.  [ruby-core:10288]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@11712 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
matz 2007-02-13 15:31:18 +00:00
parent 62815a50bc
commit 76a27adfda
3 changed files with 10 additions and 5 deletions

View File

@ -1,3 +1,8 @@
Wed Feb 14 00:30:07 2007 Yukihiro Matsumoto <matz@ruby-lang.org>
* ext/socket/socket.c (init_unixsock): path may contain NUL for
abstract unix sockets. [ruby-core:10288]
Tue Feb 13 02:21:12 2007 Sam Roberts <sroberts@uniserve.com>
* io.c (rb_f_syscall): Fix buffer overflow with syscall

View File

@ -1602,7 +1602,7 @@ init_unixsock(VALUE sock, VALUE path, int server)
rb_raise(rb_eArgError, "too long unix socket path (max: %dbytes)",
(int)sizeof(sockaddr.sun_path)-1);
}
strcpy(sockaddr.sun_path, StringValueCStr(path));
memcpy(sockaddr.sun_path, RSTRING_PTR(path), RSTRING_LEN(path));
if (server) {
status = bind(fd, (struct sockaddr*)&sockaddr, sizeof(sockaddr));
@ -1628,8 +1628,8 @@ init_unixsock(VALUE sock, VALUE path, int server)
if (server) listen(fd, 5);
init_sock(sock, fd);
GetOpenFile(sock, fptr);
if (server) {
GetOpenFile(sock, fptr);
fptr->path = strdup(RSTRING_PTR(path));
}

View File

@ -1,7 +1,7 @@
#define RUBY_VERSION "1.9.0"
#define RUBY_RELEASE_DATE "2007-02-13"
#define RUBY_RELEASE_DATE "2007-02-14"
#define RUBY_VERSION_CODE 190
#define RUBY_RELEASE_CODE 20070213
#define RUBY_RELEASE_CODE 20070214
#define RUBY_PATCHLEVEL 0
#define RUBY_VERSION_MAJOR 1
@ -9,7 +9,7 @@
#define RUBY_VERSION_TEENY 0
#define RUBY_RELEASE_YEAR 2007
#define RUBY_RELEASE_MONTH 2
#define RUBY_RELEASE_DAY 13
#define RUBY_RELEASE_DAY 14
RUBY_EXTERN const char ruby_version[];
RUBY_EXTERN const char ruby_release_date[];