$OpenBSD: patch-libatalk_adouble_ad_open_c,v 1.1 2003/08/22 11:18:19 naddy Exp $
--- libatalk/adouble/ad_open.c.orig	Mon Aug 18 12:59:47 2003
+++ libatalk/adouble/ad_open.c	Mon Aug 18 13:04:54 2003
@@ -495,29 +495,29 @@ ad_path( path, adflags )
     char	*path;
     int		adflags;
 {
-    static char	pathbuf[ MAXPATHLEN + 1];
-    char	c, *slash, buf[MAXPATHLEN + 1];
+    static char	pathbuf[ MAXPATHLEN];
+    char	c, *slash, buf[MAXPATHLEN];
 
-    strncpy(buf, path, MAXPATHLEN);
+    strncpy(buf, path, (MAXPATHLEN-1));
     if ( adflags & ADFLAGS_DIR ) {
-	strncpy( pathbuf, buf, MAXPATHLEN );
+	strncpy( pathbuf, buf, (MAXPATHLEN-1));
 	if ( *buf != '\0' ) {
-	    strcat( pathbuf, "/" );
+	    (void)strlcat( pathbuf, "/", sizeof(pathbuf));
 	}
 	slash = ".Parent";
     } else {
 	if (( slash = strrchr( buf, '/' )) != NULL ) {
 	    c = *++slash;
 	    *slash = '\0';
-	    strncpy( pathbuf, buf, MAXPATHLEN);
+	    strncpy( pathbuf, buf, (MAXPATHLEN-1));
 	    *slash = c;
 	} else {
 	    pathbuf[ 0 ] = '\0';
 	    slash = buf;
 	}
     }
-    strncat( pathbuf, ".AppleDouble/", MAXPATHLEN - strlen(pathbuf));
-    strncat( pathbuf, slash, MAXPATHLEN - strlen(pathbuf));
+    strncat( pathbuf, ".AppleDouble/", (MAXPATHLEN-1) - strlen(pathbuf));
+    strncat( pathbuf, slash, (MAXPATHLEN-1) - strlen(pathbuf));
 
     return( pathbuf );
 }
@@ -534,10 +534,10 @@ char 
 *ad_dir(path)
     char		*path;
 {
-    static char		modebuf[ MAXPATHLEN + 1];
+    static char		modebuf[MAXPATHLEN];
     char 		*slash;
 
-    if ( strlen( path ) >= MAXPATHLEN ) {
+    if ( strlen( path ) >= (MAXPATHLEN-1)) {
 	return NULL;  /* can't do it */
     }
 
@@ -546,7 +546,7 @@ char 
      * (path or subdirectory name) to get the name we want to stat.
      * For a path which is just a filename, use "." instead.
      */
-    strcpy( modebuf, path );
+    (void)strlcpy( modebuf, path, sizeof(modebuf));
     if (( slash = strrchr( modebuf, '/' )) != NULL ) {
 	*slash = '\0';		/* remove pathname component */
     } else {
