1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

merges r20771 and r20772 from trunk into ruby_1_9_1.

* ruby.c (set_arg0): use strlcpy() instead of strncpy().

	* load.c (rb_feature_p): ditto.

	* dln.c (dln_load): ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_1@20824 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
yugui 2008-12-17 06:17:22 +00:00
parent d3ab1b9c27
commit 7dbb64a2ea
4 changed files with 12 additions and 5 deletions

View file

@ -1,3 +1,11 @@
Tue Dec 16 11:37:07 2008 NAKAMURA Usaku <usa@ruby-lang.org>
* ruby.c (set_arg0): use strlcpy() instead of strncpy().
* load.c (rb_feature_p): ditto.
* dln.c (dln_load): ditto.
Tue Dec 16 09:14:28 2008 Yukihiro Matsumoto <matz@ruby-lang.org>
* parse.y (block_call): block should not be given to yield.

4
dln.c
View file

@ -1433,8 +1433,8 @@ dln_load(const char *file)
if (err_stat != B_NO_ERROR) {
char real_name[MAXPATHLEN];
strcpy(real_name, buf);
strcat(real_name, "__Fv");
strlcpy(real_name, buf, MAXPATHLEN);
strlcat(real_name, "__Fv", MAXPATHLEN);
err_stat = get_image_symbol(img_id, real_name,
B_SYMBOL_TYPE_TEXT, (void **)&init_fct);
}

2
load.c
View file

@ -193,7 +193,7 @@ rb_feature_p(const char *feature, const char *ext, int rb, int expanded, const c
buf = RSTRING_PTR(bufstr);
MEMCPY(buf, feature, char, len);
for (i = 0; (e = loadable_ext[i]) != 0; i++) {
strncpy(buf + len, e, DLEXT_MAXLEN + 1);
strlcpy(buf + len, e, DLEXT_MAXLEN + 1);
if (st_get_key(loading_tbl, (st_data_t)buf, &data)) {
rb_str_resize(bufstr, 0);
if (fn) *fn = (const char*)data;

3
ruby.c
View file

@ -1619,8 +1619,7 @@ set_arg0(VALUE val, ID id)
if (i > PST_CLEN) {
union pstun un;
char buf[PST_CLEN + 1]; /* PST_CLEN is 64 (HP-UX 11.23) */
strncpy(buf, s, PST_CLEN);
buf[PST_CLEN] = '\0';
strlcpy(buf, s, sizeof(buf));
un.pst_command = buf;
pstat(PSTAT_SETCMD, un, PST_CLEN, 0, 0);
}