diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2009-03-17 01:29:17 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2009-03-17 01:29:17 +0000 |
commit | 22cde7b682328ba195ce0ee214edb6c2feb81b23 (patch) | |
tree | 7873fbf3dad59cb2042390c1c2dbfe90d5b6e647 /parse.y | |
parent | ea9628c3bc700c5162a6298b79d2b8cd7a334fea (diff) | |
download | ruby-22cde7b682328ba195ce0ee214edb6c2feb81b23.tar.gz |
* dir.c, dln.c, parse.y, re.c, ruby.c, sprintf.c, strftime.c,
string.c, util.c, variable.c: use strlcpy, memcpy and snprintf
instead of strcpy, strncpy and sprintf.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22984 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'parse.y')
-rw-r--r-- | parse.y | 14 |
1 files changed, 7 insertions, 7 deletions
@@ -881,10 +881,10 @@ stmt : keyword_alias fitem {lex_state = EXPR_FNAME;} fitem | keyword_alias tGVAR tBACK_REF { /*%%%*/ - char buf[3]; - - sprintf(buf, "$%c", (char)$3->nd_nth); - $$ = NEW_VALIAS($2, rb_intern(buf)); + char buf[2]; + buf[0] = '$'; + buf[1] = (char)$3->nd_nth; + $$ = NEW_VALIAS($2, rb_intern2(buf, 2)); /*% $$ = dispatch2(var_alias, $2, $3); %*/ @@ -7041,7 +7041,7 @@ parser_yylex(struct parser_params *parser) if (nondigit) { char tmp[30]; trailing_uc: - sprintf(tmp, "trailing `%c' in number", nondigit); + snprintf(tmp, sizeof(tmp), "trailing `%c' in number", nondigit); yyerror(tmp); } if (is_float) { @@ -10011,9 +10011,9 @@ ripper_id2sym(ID id) char buf[8]; if (id <= 256) { - buf[0] = id; + buf[0] = (char)id; buf[1] = '\0'; - return ID2SYM(rb_intern(buf)); + return ID2SYM(rb_intern2(buf, 1)); } if ((name = keyword_id_to_str(id))) { return ID2SYM(rb_intern(name)); |