summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDag-Erling Smørgrav <des@FreeBSD.org>2003-01-22 10:55:36 +0000
committerDag-Erling Smørgrav <des@FreeBSD.org>2003-01-22 10:55:36 +0000
commit5da7cece45f11f0ffc3957e4770b2d55f869ad4d (patch)
tree9b5294612d80bd0160cf8e56dee0f652d1cf7445
parent033aebebc4a1038f8c662edd30be8dbc5d359219 (diff)
Notes
-rw-r--r--contrib/opie/libopie/newseed.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/contrib/opie/libopie/newseed.c b/contrib/opie/libopie/newseed.c
index f32b075f97d0..2965b0efc6a7 100644
--- a/contrib/opie/libopie/newseed.c
+++ b/contrib/opie/libopie/newseed.c
@@ -43,22 +43,21 @@ int opienewseed FUNCTION((seed), char *seed)
return -1;
if (seed[0]) {
- char *c, *end;
+ char *c;
unsigned int i, max;
if ((i = strlen(seed)) > OPIE_SEED_MAX)
i = OPIE_SEED_MAX;
- for (c = end = seed + i - 1, max = 1;
- (c > seed) && isdigit(*c); c--)
+ for (c = seed + i - 1, max = 1;
+ (c >= seed) && isdigit(*c); c--)
max *= 10;
if ((i = strtoul(++c, (char **)0, 10)) < max) {
if (++i >= max)
i = 1;
- snprintf(c, end - c, "%d", i);
- seed[OPIE_SEED_MAX] = 0;
+ sprintf(c, "%d", i);
return 0;
}
}