diff --git a/ChangeLog b/ChangeLog index 5f9a6e9163..95a6d4f46c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +Tue Dec 16 11:37:07 2008 NAKAMURA Usaku + + * ruby.c (set_arg0): use strlcpy() instead of strncpy(). + + * load.c (rb_feature_p): ditto. + Tue Dec 16 09:14:28 2008 Yukihiro Matsumoto * parse.y (block_call): block should not be given to yield. diff --git a/load.c b/load.c index 4166d9cd26..efe130c4f6 100644 --- a/load.c +++ b/load.c @@ -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; diff --git a/ruby.c b/ruby.c index 24f1b706c3..ee21195b95 100644 --- a/ruby.c +++ b/ruby.c @@ -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); }