diff options
author | Robert Griebl <griebl@gmx.de> | 2002-07-19 00:05:54 +0000 |
---|---|---|
committer | Robert Griebl <griebl@gmx.de> | 2002-07-19 00:05:54 +0000 |
commit | d378c3149c6c24e7788f04a6d20ba360f3ea407e (patch) | |
tree | 945ff88bbbde5a32c2b3342b22d801be90ea40f2 /coreutils/expr.c | |
parent | 88947dd05e28a3b793b16dfd6db1b5414ca99017 (diff) | |
download | busybox-w32-d378c3149c6c24e7788f04a6d20ba360f3ea407e.tar.gz busybox-w32-d378c3149c6c24e7788f04a6d20ba360f3ea407e.tar.bz2 busybox-w32-d378c3149c6c24e7788f04a6d20ba360f3ea407e.zip |
Applied vodz' patches #49 and #50 (with a small correction in runshell.c)
#49: I found one memory overflow and memory leak in "ln" applet.
Last patch reduced also 54 bytes. ;)
#50: I found bug in loginutils/Makefile.in.
New patch have also new function to libbb and
aplied this to applets and other cosmetic changes.
Diffstat (limited to 'coreutils/expr.c')
-rw-r--r-- | coreutils/expr.c | 10 |
1 files changed, 2 insertions, 8 deletions
diff --git a/coreutils/expr.c b/coreutils/expr.c index 0299cc73a..55ae3a969 100644 --- a/coreutils/expr.c +++ b/coreutils/expr.c | |||
@@ -146,12 +146,8 @@ static int null (VALUE *v) | |||
146 | 146 | ||
147 | static void tostring (VALUE *v) | 147 | static void tostring (VALUE *v) |
148 | { | 148 | { |
149 | char *temp; | ||
150 | |||
151 | if (v->type == integer) { | 149 | if (v->type == integer) { |
152 | temp = xmalloc (4 * (sizeof (int) / sizeof (char))); | 150 | bb_asprintf (&(v->u.s), "%d", v->u.i); |
153 | sprintf (temp, "%d", v->u.i); | ||
154 | v->u.s = temp; | ||
155 | v->type = string; | 151 | v->type = string; |
156 | } | 152 | } |
157 | } | 153 | } |
@@ -377,9 +373,7 @@ static VALUE *eval6 (void) | |||
377 | else { | 373 | else { |
378 | v = xmalloc (sizeof(VALUE)); | 374 | v = xmalloc (sizeof(VALUE)); |
379 | v->type = string; | 375 | v->type = string; |
380 | v->u.s = strncpy ((char *) xmalloc (i2->u.i + 1), | 376 | v->u.s = xstrndup(l->u.s + i1->u.i - 1, i2->u.i); |
381 | l->u.s + i1->u.i - 1, i2->u.i); | ||
382 | v->u.s[i2->u.i] = 0; | ||
383 | } | 377 | } |
384 | freev (l); | 378 | freev (l); |
385 | freev (i1); | 379 | freev (i1); |