ruby-changes:9286
From: yugui <ko1@a...>
Date: Wed, 17 Dec 2008 15:17:51 +0900 (JST)
Subject: [ruby-changes:9286] Ruby:r20824 (ruby_1_9_1): merges r20771 and r20772 from trunk into ruby_1_9_1.
yugui 2008-12-17 15:17:22 +0900 (Wed, 17 Dec 2008) New Revision: 20824 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=20824 Log: 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. Modified files: branches/ruby_1_9_1/ChangeLog branches/ruby_1_9_1/dln.c branches/ruby_1_9_1/load.c branches/ruby_1_9_1/ruby.c Index: ruby_1_9_1/ChangeLog =================================================================== --- ruby_1_9_1/ChangeLog (revision 20823) +++ ruby_1_9_1/ChangeLog (revision 20824) @@ -1,3 +1,11 @@ +Tue Dec 16 11:37:07 2008 NAKAMURA Usaku <usa@r...> + + * 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@r...> * parse.y (block_call): block should not be given to yield. Index: ruby_1_9_1/load.c =================================================================== --- ruby_1_9_1/load.c (revision 20823) +++ ruby_1_9_1/load.c (revision 20824) @@ -193,7 +193,7 @@ 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; Index: ruby_1_9_1/dln.c =================================================================== --- ruby_1_9_1/dln.c (revision 20823) +++ ruby_1_9_1/dln.c (revision 20824) @@ -1433,8 +1433,8 @@ 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); } Index: ruby_1_9_1/ruby.c =================================================================== --- ruby_1_9_1/ruby.c (revision 20823) +++ ruby_1_9_1/ruby.c (revision 20824) @@ -1619,8 +1619,7 @@ 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); } -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/