--- etc/afpd/ofork.c.orig	Fri Apr 17 14:01:42 1998
+++ etc/afpd/ofork.c	Wed Nov 24 14:23:32 1999
@@ -8,6 +8,7 @@
 #include <sys/resource.h>
 #include <stdio.h>
 #include <stdlib.h>
+#include <string.h>
 #include <strings.h>
 #include <syslog.h>
 
@@ -18,12 +19,15 @@
 
 static struct ofork	**oforks;
 static int		nforks;
-static u_short		lastrefnum = 0;
+static u_int16_t	lastrefnum = 0;
 
+int			flushfork();
+
+void
 pforkdesc( f )
     FILE	*f;
 {
-    u_short	ofrefnum;
+    u_int16_t	ofrefnum;
 
     for ( ofrefnum = 0; ofrefnum < nforks; ofrefnum++ ) {
 	if ( oforks[ ofrefnum ] != NULL ) {
@@ -32,6 +36,7 @@
     }
 }
 
+void
 of_init()
 {
     struct rlimit	rl;
@@ -58,9 +63,10 @@
     return;
 }
 
+int
 of_flush()
 {
-    u_short	refnum;
+    u_int16_t	refnum;
 
     for ( refnum = 0; refnum < nforks; refnum++ ) {
 	if ( oforks[ refnum ] != NULL &&
@@ -75,10 +81,11 @@
 of_alloc( dir, path, ofrefnum )
     struct dir		*dir;
     char		*path;
-    u_short		*ofrefnum;
+    u_int16_t		*ofrefnum;
 {
-    u_short		refnum;
+    u_int16_t		refnum;
     int			i;
+    size_t		len;
 
     for ( refnum = lastrefnum++, i = 0; i < nforks; i++, refnum++ ) {
 	if ( oforks[ refnum % nforks ] == NULL ) {
@@ -95,27 +102,29 @@
 	exit( 1 );
     }
     oforks[ refnum % nforks ]->of_dir = dir;
+    len = (strlen( path ) + 1);
     if (( oforks[ refnum % nforks ]->of_name =
-	    (char *)malloc( strlen( path ) + 1 )) == NULL ) {
+	    (char *)malloc( len )) == NULL ) {
 	syslog( LOG_ERR, "of_alloc: malloc: %m" );
 	exit( 1 );
     }
-    strcpy( oforks[ refnum % nforks ]->of_name, path );
+    (void)strlcpy( oforks[ refnum % nforks ]->of_name, path, len );
     *ofrefnum = refnum;
     return( oforks[ refnum % nforks ] );
 }
 
     struct ofork *
 of_find( ofrefnum )
-    u_short	ofrefnum;
+    u_int16_t	ofrefnum;
 {
     return( oforks[ ofrefnum % nforks ] );
 }
 
+void
 of_dealloc( of )
     struct ofork	*of;
 {
-    u_short		refnum;
+    u_int16_t		refnum;
 
     for ( refnum = 0; refnum < nforks; refnum++ ) {
 	if ( oforks[ refnum ] == of ) {
@@ -138,7 +147,6 @@
     struct dir	*dir;
     char	*path;
 {
-    u_short		refnum;
     int			i;
 
     for ( i = 0; i < nforks; i++ ) {
