merge strcpy_truncate branch

git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@5027 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained in:
Johan Danielsson
1998-06-09 19:25:40 +00:00
parent e255dfc950
commit a5f54865d4
87 changed files with 689 additions and 499 deletions

View File

@@ -47,7 +47,7 @@ static char userprompt[128];
#ifdef KRB4
static char name[ANAME_SZ];
static char inst[INST_SZ];
static char realm[REALM_SZ + 1];
static char realm[REALM_SZ];
#endif
#ifdef KRB5
static krb5_context context;
@@ -251,8 +251,8 @@ init_words (int argc, char **argv)
errx (1, "cannot allocate memory for message");
appres.text[0] = 0;
for(; i < j; i++){
strcat(appres.text, argv[i]);
strcat(appres.text, " ");
strcat_truncate(appres.text, argv[i], len);
strcat_truncate(appres.text, " ", len);
}
}
}
@@ -798,7 +798,8 @@ talk(int force_erase)
XSetForeground(dpy, gc, White);
talking = 1;
walk(FRONT);
p = strcpy(buf, words);
strcpy_truncate (buf, words, sizeof(buf));
p = buf;
/* possibly avoid a lot of work here
* if no CR or only one, then just print the line
@@ -832,7 +833,7 @@ talk(int force_erase)
if ((w = XTextWidth(font, p, p2 - p)) > width)
width = w;
total += p2 - p; /* total chars; count to determine reading time */
strcpy(args[height], p);
strcpy_truncate(args[height], p, sizeof(args[height]));
if (height == MAXLINES - 1) {
puts("Message too long!");
break;
@@ -927,15 +928,14 @@ main (int argc, char **argv)
struct passwd *pw;
if (!(pw = k_getpwuid(0)))
errx (1, "can't get root's passwd!");
strcpy(root_cpass, pw->pw_passwd);
strcpy_truncate(root_cpass, pw->pw_passwd, sizeof(root_cpass));
if (!(pw = k_getpwuid(getuid())))
errx (1, "Can't get your password entry!");
strcpy(user_cpass, pw->pw_passwd);
strcpy_truncate(user_cpass, pw->pw_passwd, sizeof(user_cpass));
setuid(getuid());
/* Now we're no longer running setuid root. */
strncpy(login, pw->pw_name, sizeof(login));
login[sizeof(login) - 1] = '\0';
strcpy_truncate(login, pw->pw_name, sizeof(login));
}
srand(getpid());