replace sprintf all over the place

git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@1635 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
Assar Westerlund
1997-05-02 14:29:33 +00:00
parent 1495f52771
commit dd02a92a8b
55 changed files with 831 additions and 471 deletions

View File

@@ -94,10 +94,11 @@ renew (int argc, char **argv, OtpAlgorithm *alg, char *user)
strncpy (newctx.seed, argv[1], sizeof(newctx.seed));
newctx.seed[sizeof(newctx.seed) - 1] = '\0';
strlwr(newctx.seed);
sprintf (prompt, "[ otp-%s %u %s ]",
newctx.alg->name,
newctx.n,
newctx.seed);
snprintf (prompt, sizeof(prompt),
"[ otp-%s %u %s ]",
newctx.alg->name,
newctx.n,
newctx.seed);
if (des_read_pw_string (pw, sizeof(pw), prompt, 0) == 0 &&
otp_parse (newctx.key, pw, alg) == 0) {
ctx = &newctx;
@@ -132,7 +133,7 @@ verify_user_otp(char *username)
return 1;
}
sprintf (prompt, "%s's %s Password: ", username, ss);
snprintf (prompt, sizeof(prompt), "%s's %s Password: ", username, ss);
des_read_pw_string(passwd, sizeof(passwd)-1, prompt, 0);
return otp_verify_user (&ctx, passwd);
}

View File

@@ -54,7 +54,7 @@ print (int argc,
char **argv,
int count,
OtpAlgorithm *alg,
void (*print_fn)(OtpKey, char *))
void (*print_fn)(OtpKey, char *, size_t))
{
char pw[64];
OtpKey key;
@@ -74,7 +74,7 @@ print (int argc,
alg->next (key);
if (i >= n - count) {
(*print_fn)(key, s);
(*print_fn)(key, s, sizeof(s));
printf ("%d: %s\n", i + 1, s);
}
}
@@ -88,7 +88,7 @@ main (int argc, char **argv)
int count = 10;
int hexp = 0;
int extendedp = 0;
void (*fn)(OtpKey, char *);
void (*fn)(OtpKey, char *, size_t);
OtpAlgorithm *alg = otp_find_alg (OTP_ALG_DEFAULT);
set_progname (argv[0]);