diff options
author | Ken Raeburn <raeburn@mit.edu> | 2000-06-30 00:36:31 +0000 |
---|---|---|
committer | Ken Raeburn <raeburn@mit.edu> | 2000-06-30 00:36:31 +0000 |
commit | 3cdd5a1bf70b6233b7ffd0e81bcc267435a907dc (patch) | |
tree | 67b5d0422cdd1c4b25e55c1e54bdae54e114c008 /src/slave | |
parent | 5aaaaf07695e6b4b4b024973984a9e8856484453 (diff) | |
download | krb5-3cdd5a1bf70b6233b7ffd0e81bcc267435a907dc.tar.gz krb5-3cdd5a1bf70b6233b7ffd0e81bcc267435a907dc.tar.xz krb5-3cdd5a1bf70b6233b7ffd0e81bcc267435a907dc.zip |
pullup from 1.2-beta4
git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@12472 dc483132-0cff-0310-8789-dd5450dbe970
Diffstat (limited to 'src/slave')
-rw-r--r-- | src/slave/ChangeLog | 6 | ||||
-rw-r--r-- | src/slave/kprop.c | 15 |
2 files changed, 15 insertions, 6 deletions
diff --git a/src/slave/ChangeLog b/src/slave/ChangeLog index b8f8e9026c..c60c05efad 100644 --- a/src/slave/ChangeLog +++ b/src/slave/ChangeLog @@ -1,3 +1,9 @@ +2000-05-08 Nalin Dahyabhai <nalin@redhat.com> + + * kprop.c (open_connection): New argument indicates output buffer + size. Don't overrun it. + (get_tickets): Pass size of Errmsg. + 1999-10-26 Wilfredo Sanchez <tritan@mit.edu> * Makefile.in: Clean up usage of CFLAGS, CPPFLAGS, DEFS, DEFINES, diff --git a/src/slave/kprop.c b/src/slave/kprop.c index 5b6b5969b0..fa32f11a84 100644 --- a/src/slave/kprop.c +++ b/src/slave/kprop.c @@ -72,7 +72,7 @@ void get_tickets static void usage PROTOTYPE((void)); krb5_error_code open_connection - PROTOTYPE((char *, int *, char *)); + PROTOTYPE((char *, int *, char *, int)); void kerberos_authenticate PROTOTYPE((krb5_context, krb5_auth_context *, int, krb5_principal, krb5_creds **)); @@ -116,7 +116,7 @@ main(argc, argv) get_tickets(context); database_fd = open_database(context, file, &database_size); - if (retval = open_connection(slave_host, &fd, Errmsg)) { + if (retval = open_connection(slave_host, &fd, Errmsg, sizeof(Errmsg))) { com_err(progname, retval, "%s while opening connection to %s", Errmsg, slave_host); exit(1); @@ -307,10 +307,11 @@ void get_tickets(context) } krb5_error_code -open_connection(host, fd, Errmsg) +open_connection(host, fd, Errmsg, ErrmsgSz) char *host; int *fd; char *Errmsg; + int ErrmsgSz; { int s; krb5_error_code retval; @@ -331,8 +332,9 @@ open_connection(host, fd, Errmsg) if(!port) { sp = getservbyname(KPROP_SERVICE, "tcp"); if (sp == 0) { - (void) strcpy(Errmsg, KPROP_SERVICE); - (void) strcat(Errmsg, "/tcp: unknown service"); + (void) strncpy(Errmsg, KPROP_SERVICE, ErrmsgSz - 1); + Errmsg[ErrmsgSz - 1] = '\0'; + (void) strncat(Errmsg, "/tcp: unknown service", ErrmsgSz - 1 - strlen(Errmsg)); *fd = -1; return(0); } @@ -481,7 +483,8 @@ open_database(context, data_fn, size) com_err(progname, ENOMEM, "while trying to malloc data_ok_fn"); exit(1); } - strcat(strcpy(data_ok_fn, data_fn), ok); + strcpy(data_ok_fn, data_fn); + strcat(data_ok_fn, ok); if (stat(data_ok_fn, &stbuf_ok)) { com_err(progname, errno, "while trying to stat %s", data_ok_fn); |