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:
@@ -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);
|
||||
}
|
||||
|
@@ -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]);
|
||||
|
Reference in New Issue
Block a user