From 4165f94e5100aa0f4b6a4f806a2c32bb8c13035b Mon Sep 17 00:00:00 2001 From: Rosen Penev Date: Sat, 4 Nov 2017 23:22:59 -0700 Subject: [PATCH] Change memcpy to memmove since it overlaps --- src/rp_cpu.c | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/src/rp_cpu.c b/src/rp_cpu.c index fc11d645a..ca50ae446 100644 --- a/src/rp_cpu.c +++ b/src/rp_cpu.c @@ -253,11 +253,11 @@ static int mangle_insert_multi (char arr[RP_PASSWORD_SIZE], int arr_len, int arr if (arr2_cpy < 1) return (RULE_RC_SYNTAX_ERROR); - memcpy (arr2, arr2 + arr2_pos, arr2_len - arr2_pos); + memmove (arr2, arr2 + arr2_pos, arr2_len - arr2_pos); - memcpy (arr2 + arr2_cpy, arr + arr_pos, arr_len - arr_pos); + memcpy (arr2 + arr2_cpy, arr + arr_pos, arr_len - arr_pos); - memcpy (arr + arr_pos, arr2, arr_len - arr_pos + arr2_cpy); + memcpy (arr + arr_pos, arr2, arr_len - arr_pos + arr2_cpy); return (arr_len + arr2_cpy); } @@ -844,14 +844,10 @@ int _old_apply_rule (char *rule, int rule_len, char in[RP_PASSWORD_SIZE], int in int run_rule_engine (const int rule_len, const char *rule_buf) { - if (rule_len == 0) - { - return 0; - } - else if (rule_len == 1) - { + if (rule_len == 0) return 0; + + if (rule_len == 1) if (rule_buf[0] == RULE_OP_MANGLE_NOOP) return 0; - } return 1; }