$OpenBSD: patch-etc_afpd_file_c,v 1.3 2003/08/22 11:18:19 naddy Exp $
--- etc/afpd/file.c.orig	Tue Jun 10 00:53:15 2003
+++ etc/afpd/file.c	Mon Aug 18 15:06:08 2003
@@ -161,15 +161,15 @@ int getmetadata(struct vol *vol,
             } else {
                 aint = AD_DATE_FROM_UNIX(st->st_mtime);
             }
-            memcpy(data, &aint, sizeof( int ));
-            data += sizeof( int );
+            memcpy(data, &aint, sizeof( aint ));
+            data += sizeof( aint );
             break;
 
         case FILPBIT_BDATE :
             if (!adp || (ad_getdate(adp, AD_DATE_BACKUP, &aint) < 0))
                 aint = AD_DATE_START;
-            memcpy(data, &aint, sizeof( int ));
-            data += sizeof( int );
+            memcpy(data, &aint, sizeof( aint ));
+            data += sizeof( aint );
             break;
 
         case FILPBIT_FINFO :
@@ -597,7 +597,7 @@ int setfilparams(struct vol *vol,
 
     int                 change_mdate = 0;
     int                 change_parent_mdate = 0;
-    int                 newdate = 0;
+    u_int32_t           newdate = 0;
     struct timeval      tv;
 
 
@@ -788,7 +788,7 @@ char	*src, *dst, *newname;
 const int         noadouble;
 struct adouble    *adp;
 {
-    char		adsrc[ MAXPATHLEN + 1];
+    char		adsrc[MAXPATHLEN];
     int			len, rc;
 
     /*
@@ -824,7 +824,7 @@ struct adouble    *adp;
         }
     }
 
-    strcpy( adsrc, ad_path( src, 0 ));
+    (void)strlcpy(adsrc, ad_path( src, 0 ), sizeof(adsrc));
     rc = 0;
 rename_retry:
     if (rename( adsrc, ad_path( dst, 0 )) < 0 ) {
@@ -1034,13 +1034,13 @@ const int   noadouble;
     char		filebuf[8192];
     int			sfd, dfd, len, err = AFP_OK;
     ssize_t             cc;
-    char                dpath[ MAXPATHLEN + 1];
+    char                dpath[MAXPATHLEN];
     int                 admode;
 #ifdef DEBUG
     LOG(log_info, logtype_afpd, "begin copyfile:");
 #endif /* DEBUG */
 
-    strcpy(dpath, ad_path( dst, ADFLAGS_HF ));
+    (void)strlcpy(dpath, ad_path( dst, ADFLAGS_HF ), sizeof(dpath));
     admode = ad_mode( dst, 0666 );
     if (newname) {
         if ((sfd = open( ad_path( src, ADFLAGS_HF ), O_RDONLY, 0 )) < 0 ) {
@@ -1374,7 +1374,7 @@ int		ibuflen, *rbuflen;
     char		*path, *upath;
     int                 len;
     cnid_t		did, id;
-    u_short		vid;
+    u_int16_t		vid;
 
 #ifdef DEBUG
     LOG(log_info, logtype_afpd, "begin afp_createid:");
@@ -1473,8 +1473,8 @@ int		ibuflen, *rbuflen;
     cnid_t		id;
     u_int16_t		vid, bitmap;
 
-    static char buffer[12 + MAXPATHLEN + 1];
-    int len = 12 + MAXPATHLEN + 1;
+    static char buffer[12 + MAXPATHLEN];
+    int len = 12 + MAXPATHLEN;
 
 #ifdef DEBUG
     LOG(log_info, logtype_afpd, "begin afp_resolveid:");
@@ -1546,9 +1546,9 @@ int		ibuflen, *rbuflen;
     int                 err;
     cnid_t		id;
     cnid_t		fileid;
-    u_short		vid;
-    static char buffer[12 + MAXPATHLEN + 1];
-    int len = 12 + MAXPATHLEN + 1;
+    u_int16_t		vid;
+    static char buffer[12 + MAXPATHLEN];
+    int len = 12 + MAXPATHLEN;
 
 #ifdef DEBUG
     LOG(log_info, logtype_afpd, "begin afp_deleteid:");
