use strlcpy

git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@14932 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
Love Hörnquist Åstrand
2005-04-24 19:54:58 +00:00
parent 3a1c2eb89d
commit d6b87a47d9
3 changed files with 7 additions and 7 deletions

View File

@@ -123,7 +123,7 @@ TOP:
if (bell && c->c_bell) { if (bell && c->c_bell) {
putchar('\007'); putchar('\007');
} }
strcpy(line, line2); strlcpy(line, line2, sizeof(line));
makeargv(); makeargv();
argc = margc; argc = margc;
argv = margv; argv = margv;

View File

@@ -40,7 +40,7 @@ static char*
printable_time(time_t t) printable_time(time_t t)
{ {
static char s[128]; static char s[128];
strcpy(s, ctime(&t)+ 4); strlcpy(s, ctime(&t)+ 4, sizeof(s));
s[15] = 0; s[15] = 0;
return s; return s;
} }
@@ -49,7 +49,7 @@ static char*
printable_time_long(time_t t) printable_time_long(time_t t)
{ {
static char s[128]; static char s[128];
strcpy(s, ctime(&t)+ 4); strlcpy(s, ctime(&t)+ 4, sizeof(s));
s[20] = 0; s[20] = 0;
return s; return s;
} }

View File

@@ -130,7 +130,7 @@ print_entry(kadm5_server_context *server_context,
} }
if(mask & KADM5_PRINC_EXPIRE_TIME) { if(mask & KADM5_PRINC_EXPIRE_TIME) {
if(ent.valid_end == NULL) { if(ent.valid_end == NULL) {
strcpy(t, "never"); strlcpy(t, "never", sizeof(t));
} else { } else {
strftime(t, sizeof(t), "%Y-%m-%d %H:%M:%S", strftime(t, sizeof(t), "%Y-%m-%d %H:%M:%S",
localtime(ent.valid_end)); localtime(ent.valid_end));
@@ -139,7 +139,7 @@ print_entry(kadm5_server_context *server_context,
} }
if(mask & KADM5_PW_EXPIRATION) { if(mask & KADM5_PW_EXPIRATION) {
if(ent.pw_end == NULL) { if(ent.pw_end == NULL) {
strcpy(t, "never"); strlcpy(t, "never", sizeof(t));
} else { } else {
strftime(t, sizeof(t), "%Y-%m-%d %H:%M:%S", strftime(t, sizeof(t), "%Y-%m-%d %H:%M:%S",
localtime(ent.pw_end)); localtime(ent.pw_end));
@@ -155,14 +155,14 @@ print_entry(kadm5_server_context *server_context,
} }
if(mask & KADM5_MAX_LIFE) { if(mask & KADM5_MAX_LIFE) {
if(ent.max_life == NULL) if(ent.max_life == NULL)
strcpy(t, "for ever"); strlcpy(t, "for ever", sizeof(t));
else else
unparse_time(*ent.max_life, t, sizeof(t)); unparse_time(*ent.max_life, t, sizeof(t));
printf(" max life = %s\n", t); printf(" max life = %s\n", t);
} }
if(mask & KADM5_MAX_RLIFE) { if(mask & KADM5_MAX_RLIFE) {
if(ent.max_renew == NULL) if(ent.max_renew == NULL)
strcpy(t, "for ever"); strlcpy(t, "for ever", sizeof(t));
else else
unparse_time(*ent.max_renew, t, sizeof(t)); unparse_time(*ent.max_renew, t, sizeof(t));
printf(" max rlife = %s\n", t); printf(" max rlife = %s\n", t);