* file.c (BUFCHECK): wrong condition. [ruby-core:16921]

* file.c (file_expand_buf): shouldn't use buflen for length of string.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16617 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
usa 2008-05-27 03:07:55 +00:00
Родитель c3b10e7fcb
Коммит ea16f7dfc9
3 изменённых файлов: 13 добавлений и 7 удалений

Просмотреть файл

@ -1,3 +1,9 @@
Tue May 27 12:06:37 2008 NAKAMURA Usaku <usa@ruby-lang.org>
* file.c (BUFCHECK): wrong condition. [ruby-core:16921]
* file.c (file_expand_buf): shouldn't use buflen for length of string.
Mon May 26 18:24:48 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
* file.c (BUFCHECK): no resize if enough room.

8
file.c
Просмотреть файл

@ -2578,7 +2578,7 @@ ntfs_tail(const char *path)
#define BUFCHECK(cond) do {\
long bdiff = p - buf;\
if (!(cond)) {\
if (cond) {\
do {buflen *= 2;} while (cond);\
rb_str_resize(result, buflen);\
buf = RSTRING_PTR(result);\
@ -2827,7 +2827,6 @@ file_expand_path(VALUE fname, VALUE dname, VALUE result)
p += s-b;
}
if (p == skiproot(buf) - 1) p++;
buflen = p - buf;
#if USE_NTFS
*p = '\0';
@ -2877,15 +2876,16 @@ file_expand_path(VALUE fname, VALUE dname, VALUE result)
}
#endif
if (!p) p = buf;
++p;
else ++p;
BUFCHECK(bdiff + len >= buflen);
memcpy(p, wfd.cFileName, len + 1);
p += len;
}
}
#endif
if (tainted) OBJ_TAINT(result);
rb_str_set_len(result, buflen);
rb_str_set_len(result, p - buf);
rb_enc_check(fname, result);
return result;
}

Просмотреть файл

@ -1,7 +1,7 @@
#define RUBY_VERSION "1.9.0"
#define RUBY_RELEASE_DATE "2008-05-26"
#define RUBY_RELEASE_DATE "2008-05-27"
#define RUBY_VERSION_CODE 190
#define RUBY_RELEASE_CODE 20080526
#define RUBY_RELEASE_CODE 20080527
#define RUBY_PATCHLEVEL 0
#define RUBY_VERSION_MAJOR 1
@ -9,7 +9,7 @@
#define RUBY_VERSION_TEENY 0
#define RUBY_RELEASE_YEAR 2008
#define RUBY_RELEASE_MONTH 5
#define RUBY_RELEASE_DAY 26
#define RUBY_RELEASE_DAY 27
#ifdef RUBY_EXTERN
RUBY_EXTERN const char ruby_version[];