diff --git a/clients/tools/ldapmodify.c b/clients/tools/ldapmodify.c
index d6342746746c2542cfda097e19c28bd48cc11718..96a667ff118773da6b8269862f20936486d36481 100644
--- a/clients/tools/ldapmodify.c
+++ b/clients/tools/ldapmodify.c
@@ -423,7 +423,7 @@ process_ldapmod_rec( char *rbuf )
 	    rbuf = NULL;
 	} else {
 	    if ( *(p-1) == '\\' ) {	/* lines ending in '\' are continued */
-		strcpy( p - 1, p );
+		SAFEMEMCPY( p - 1, p, strlen( p ) + 1 );
 		rbuf = p;
 		continue;
 	    }
diff --git a/libraries/libldap/ufn.c b/libraries/libldap/ufn.c
index d56dc5799dbead14e344b36c1ef50ecd45fc06e6..b2c34aee80127d304d114aaf68b071de7054470c 100644
--- a/libraries/libldap/ufn.c
+++ b/libraries/libldap/ufn.c
@@ -97,7 +97,8 @@ ldap_ufn_search_ctx( LDAP *ld, char **ufncomp, int ncomp, char *prefix,
 
 			if ( (quote = strrchr( ufncomp[ncomp], '"' )) != NULL )
 				*quote = '\0';
-			strcpy( ufncomp[ncomp], ufncomp[ncomp] + 1 );
+			SAFEMEMCPY( ufncomp[ncomp], ufncomp[ncomp] + 1,
+				    strlen( ufncomp[ncomp] + 1 ) + 1 );
 		}
 		if ( ncomp == 0 )
 			phase = 3;