summaryrefslogtreecommitdiffstats
path: root/sprintf.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-03-17 01:29:17 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-03-17 01:29:17 +0000
commit68fb85a36ad39d5594c1ecfbf985d56e73adcaa5 (patch)
tree7873fbf3dad59cb2042390c1c2dbfe90d5b6e647 /sprintf.c
parent61618d9b634c10e93dcb2496b2955581cf4871e4 (diff)
downloadruby-68fb85a36ad39d5594c1ecfbf985d56e73adcaa5.tar.gz
ruby-68fb85a36ad39d5594c1ecfbf985d56e73adcaa5.tar.xz
ruby-68fb85a36ad39d5594c1ecfbf985d56e73adcaa5.zip
* 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: http://svn.ruby-lang.org/repos/ruby/trunk@22984 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'sprintf.c')
-rw-r--r--sprintf.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/sprintf.c b/sprintf.c
index 772f23206..58dedd382 100644
--- a/sprintf.c
+++ b/sprintf.c
@@ -988,7 +988,7 @@ rb_str_format(int argc, const VALUE *argv, VALUE fmt)
buf[blen++] = '+';
else if (flags & FSPACE)
blen++;
- strncpy(&buf[blen], expr, strlen(expr));
+ memcpy(&buf[blen], expr, strlen(expr));
}
else {
if (!isnan(fval) && fval < 0.0)
@@ -997,8 +997,8 @@ rb_str_format(int argc, const VALUE *argv, VALUE fmt)
buf[blen + need - strlen(expr) - 1] = '+';
else if ((flags & FSPACE) && need > width)
blen++;
- strncpy(&buf[blen + need - strlen(expr)], expr,
- strlen(expr));
+ memcpy(&buf[blen + need - strlen(expr)], expr,
+ strlen(expr));
}
blen += strlen(&buf[blen]);
break;