diff options
author | usa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-12-16 02:37:45 +0000 |
---|---|---|
committer | usa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-12-16 02:37:45 +0000 |
commit | 6a613ba2e4f23b736934b48803bfc0288edace1b (patch) | |
tree | 9f770332e0e729915f28175c1d53be2136e31032 | |
parent | 587afe728b55eacb8ed8dbf8db2f092625f18063 (diff) | |
download | ruby-6a613ba2e4f23b736934b48803bfc0288edace1b.tar.gz |
* ruby.c (set_arg0): use strlcpy() instead of strncpy().
* load.c (rb_feature_p): ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@20771 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | ChangeLog | 6 | ||||
-rw-r--r-- | load.c | 2 | ||||
-rw-r--r-- | ruby.c | 3 |
3 files changed, 8 insertions, 3 deletions
@@ -1,3 +1,9 @@ +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. + Tue Dec 16 09:14:28 2008 Yukihiro Matsumoto <matz@ruby-lang.org> * parse.y (block_call): block should not be given to yield. @@ -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; @@ -1648,8 +1648,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); } |