diff --git a/main/pbx.c b/main/pbx.c
index 3b3b1cd6db508e2f6e4cd2ff09310aed02123314..6a36f434d4e8c063c4275e5f431e9822782b63be 100644
--- a/main/pbx.c
+++ b/main/pbx.c
@@ -2927,7 +2927,7 @@ static const char *ast_str_substring(struct ast_str *value, int offset, int leng
 
 	if (offset > 0) {
 		/* Go ahead and chop off the beginning */
-		memcpy(ast_str_buffer(value), ast_str_buffer(value) + offset, ast_str_strlen(value) - offset + 1);
+		memmove(ast_str_buffer(value), ast_str_buffer(value) + offset, ast_str_strlen(value) - offset + 1);
 		lr -= offset;
 	}