Merge pull request #88 from wudicgi/fix-bug

修正了 find_env_cb() 函数中的一处判断 key 是否相等错误的 bug
pull/98/head
朱天龙 (Armink) 6 years ago committed by GitHub
commit 2d31e24352
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -711,13 +711,13 @@ static bool find_env_cb(env_node_obj_t env, void *arg1, void *arg2)
{ {
const char *key = arg1; const char *key = arg1;
bool *find_ok = arg2; bool *find_ok = arg2;
uint8_t max_len = strlen(key); size_t key_len = strlen(key);
if (max_len < env->name_len) { if (key_len != env->name_len) {
max_len = env->name_len; return false;
} }
/* check ENV */ /* 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; *find_ok = true;
return true; return true;
} }

Loading…
Cancel
Save