$OpenBSD: patch-lib_relocatable_c,v 1.2 2008/05/28 20:03:13 naddy Exp $
--- lib/relocatable.c.orig	Tue Oct 31 14:48:27 2006
+++ lib/relocatable.c	Wed May 21 17:55:51 2008
@@ -448,15 +448,19 @@ relocate (const char *pathname)
 	{
 	  /* pathname starts with orig_prefix.  */
 	  const char *pathname_tail = &pathname[orig_prefix_len];
-	  char *result =
-	    (char *) xmalloc (curr_prefix_len + strlen (pathname_tail) + 1);
+	  size_t len;
+	  char *result;
+	  
+	  len = curr_prefix_len + strlen (pathname_tail) + 1;
+	  result = (char *) xmalloc (len);
 
 #ifdef NO_XMALLOC
 	  if (result != NULL)
 #endif
 	    {
 	      memcpy (result, curr_prefix, curr_prefix_len);
-	      strcpy (result + curr_prefix_len, pathname_tail);
+	      result[curr_prefix_len] = '\0';
+	      strlcat (result, pathname_tail, len);
 	      return result;
 	    }
 	}
