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 | 68fb85a36ad39d5594c1ecfbf985d56e73adcaa5 (patch) | |
| tree | 7873fbf3dad59cb2042390c1c2dbfe90d5b6e647 /string.c | |
| parent | 61618d9b634c10e93dcb2496b2955581cf4871e4 (diff) | |
| download | ruby-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 'string.c')
| -rw-r--r-- | string.c | 6 |
1 files changed, 3 insertions, 3 deletions
@@ -4347,19 +4347,19 @@ rb_str_dump(VALUE str) if (MBCLEN_CHARFOUND_P(n)) { int cc = rb_enc_codepoint(p-1, pend, enc); p += n; - sprintf(q, "u{%x}", cc); + snprintf(q, qend-q, "u{%x}", cc); q += strlen(q); continue; } } - sprintf(q, "x%02X", c); + snprintf(q, qend-q, "x%02X", c); q += 3; } } *q++ = '"'; *q = '\0'; if (!rb_enc_asciicompat(enc)) { - sprintf(q, ".force_encoding(\"%s\")", enc->name); + snprintf(q, qend-q, ".force_encoding(\"%s\")", enc->name); enc = rb_ascii8bit_encoding(); } OBJ_INFECT(result, str); |
