Skip to content

Commit

Permalink
Merge pull request #88 from wudicgi/fix-bug
Browse files Browse the repository at this point in the history
修正了 find_env_cb() 函数中的一处判断 key 是否相等错误的 bug
  • Loading branch information
armink authored Dec 30, 2019
2 parents bcae150 + 12f8f08 commit 2d31e24
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions easyflash/src/ef_env.c
Original file line number Diff line number Diff line change
Expand Up @@ -711,13 +711,13 @@ static bool find_env_cb(env_node_obj_t env, void *arg1, void *arg2)
{
const char *key = arg1;
bool *find_ok = arg2;
uint8_t max_len = strlen(key);
size_t key_len = strlen(key);

if (max_len < env->name_len) {
max_len = env->name_len;
if (key_len != env->name_len) {
return false;
}
/* check ENV */
if (env->crc_is_ok && env->status == ENV_WRITE && !strncmp(env->name, key, max_len)) {
if (env->crc_is_ok && env->status == ENV_WRITE && !strncmp(env->name, key, key_len)) {
*find_ok = true;
return true;
}
Expand Down

0 comments on commit 2d31e24

Please sign in to comment.