$OpenBSD: patch-etc_afpd_directory_c,v 1.3 2003/08/22 11:18:19 naddy Exp $
--- etc/afpd/directory.c.orig	Sat Feb  8 09:08:36 2003
+++ etc/afpd/directory.c	Mon Aug 18 15:13:37 2003
@@ -129,12 +129,12 @@ u_int32_t	did;
     struct dir *ret;
     char		*upath;
     u_int32_t	id;
-    static char		path[MAXPATHLEN + 1];
+    static char		path[MAXPATHLEN];
     int len;
     int pathlen;
     char *ptr;
-    static char buffer[12 + MAXPATHLEN + 1];
-    int buflen = 12 + MAXPATHLEN + 1;
+    static char buffer[12 + MAXPATHLEN];
+    int buflen = 12 + MAXPATHLEN;
     char *mpath;
     
     ret = dirsearch(vol, did);
@@ -505,7 +505,7 @@ char	*path;
 
 static int deletedir(char *dir)
 {
-    char path[MAXPATHLEN + 1];
+    char path[MAXPATHLEN];
     DIR *dp;
     struct dirent	*de;
     struct stat st;
@@ -577,7 +577,7 @@ static int deletedir(char *dir)
 /* do a recursive copy. */
 static int copydir(char *src, char *dst, int noadouble)
 {
-    char spath[MAXPATHLEN + 1], dpath[MAXPATHLEN + 1];
+    char spath[MAXPATHLEN], dpath[MAXPATHLEN];
     DIR *dp;
     struct dirent	*de;
     struct stat st;
@@ -585,8 +585,8 @@ static int copydir(char *src, char *dst,
     int slen, dlen, err;
 
     /* doesn't exist or the path is too long. */
-    if (((slen = strlen(src)) > sizeof(spath) - 2) ||
-            ((dlen = strlen(dst)) > sizeof(dpath) - 2) ||
+    if (((slen = strlen(src)) > sizeof(spath) - 1) ||
+            ((dlen = strlen(dst)) > sizeof(dpath) - 1) ||
             ((dp = opendir(src)) == NULL))
         return AFPERR_PARAM;
 
@@ -612,11 +612,11 @@ static int copydir(char *src, char *dst,
     }
 
     /* set things up to copy */
-    strcpy(spath, src);
-    strcat(spath, "/");
+    (void)strlcpy(spath, src, sizeof(spath));
+    (void)strlcat(spath, "/", sizeof(spath));
     slen++;
-    strcpy(dpath, dst);
-    strcat(dpath, "/");
+    (void)strlcpy(dpath, dst, sizeof(dpath));
+    (void)strlcat(dpath, "/", sizeof(dpath));
     dlen++;
     err = AFP_OK;
     while ((de = readdir(dp))) {
@@ -764,7 +764,7 @@ struct dir	*dir;
 char	**cpath;
 {
     struct dir		*cdir;
-    static char		path[ MAXPATHLEN + 1];
+    static char		path[MAXPATHLEN];
     char		*data, *p;
     char        *u;
     int			extend = 0;
@@ -809,8 +809,7 @@ char	**cpath;
             		return NULL; /* give up the whole tree is out of synch*/
             	}
 				/* restore the previous token */
-        		strncpy(path, u, olen);
-        		path[olen] = '\0';
+        		(void)strlcpy(path, u, olen);
             }
             return( path );
         }
@@ -916,7 +915,7 @@ int movecwd( vol, dir)
 const struct vol	*vol;
 struct dir	*dir;
 {
-    char path[MAXPATHLEN + 1];
+    char path[MAXPATHLEN];
     struct dir	*d;
     char	*p, *u;
     int		n;
@@ -1228,7 +1227,7 @@ int setdirparams(const struct vol *vol, 
     int                 err = AFP_OK;
     int                 change_mdate = 0;
     int                 change_parent_mdate = 0;
-    int                 newdate = 0;
+    u_int16_t           newdate = 0;
 
     upath = mtoupath(vol, path);
     memset(&ad, 0, sizeof(ad));
