mirror of
https://github.com/ruby/ruby.git
synced 2025-09-15 08:33:58 +02:00
* dir.c (rb_glob2): do not allocate buffer from heap to avoid
memory leaks. use string object for buffering instead. [ruby-dev:24738] * dir.c (join_path): ditto. * io.c (io_read): external input buffer may be modified even after rb_str_locktmp(). [ruby-dev:24735] * dir.c (fnmatch): p or s may be NULL. [ruby-dev:24749] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@7242 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
63b9174a64
commit
683400f427
9 changed files with 126 additions and 86 deletions
|
@ -476,9 +476,6 @@ s_recvfrom(sock, argc, argv, from)
|
|||
retry:
|
||||
rb_str_locktmp(str);
|
||||
rb_thread_wait_fd(fd);
|
||||
if (buflen != RSTRING(str)->len) {
|
||||
rb_raise(rb_eRuntimeError, "buffer modified");
|
||||
}
|
||||
TRAP_BEG;
|
||||
slen = recvfrom(fd, RSTRING(str)->ptr, buflen, flags, (struct sockaddr*)buf, &alen);
|
||||
TRAP_END;
|
||||
|
@ -1989,8 +1986,6 @@ sock_connect(sock, addr)
|
|||
int fd, n;
|
||||
|
||||
StringValue(addr);
|
||||
rb_str_modify(addr);
|
||||
|
||||
GetOpenFile(sock, fptr);
|
||||
fd = fileno(fptr->f);
|
||||
rb_str_locktmp(addr);
|
||||
|
@ -2010,8 +2005,6 @@ sock_bind(sock, addr)
|
|||
OpenFile *fptr;
|
||||
|
||||
StringValue(addr);
|
||||
rb_str_modify(addr);
|
||||
|
||||
GetOpenFile(sock, fptr);
|
||||
if (bind(fileno(fptr->f), (struct sockaddr*)RSTRING(addr)->ptr, RSTRING(addr)->len) < 0)
|
||||
rb_sys_fail("bind(2)");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue