mirror of
https://gitlab.com/cryptsetup/cryptsetup.git
synced 2025-12-12 19:30:04 +01:00
Fix few bugs in previous commit.
- crypt_token_register must not be called from withing crypt_token_load (see later commits) - minor bug in dlvsym/dlerror handling - check for overflow in LUKS2_token_handler_type
This commit is contained in:
committed by
Milan Broz
parent
2178461c89
commit
f677bdc12f
@@ -67,12 +67,7 @@ static const crypt_token_handler
|
|||||||
token = dlvsym(handle, CRYPT_TOKEN_ABI_HANDLER, CRYPT_TOKEN_ABI_VERSION1);
|
token = dlvsym(handle, CRYPT_TOKEN_ABI_HANDLER, CRYPT_TOKEN_ABI_VERSION1);
|
||||||
error = dlerror();
|
error = dlerror();
|
||||||
if (error) {
|
if (error) {
|
||||||
log_dbg(NULL, "%s", dlerror());
|
log_dbg(NULL, "%s", error);
|
||||||
dlclose(handle);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (crypt_token_register(token) < 0) {
|
|
||||||
dlclose(handle);
|
dlclose(handle);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@@ -144,10 +139,15 @@ static const crypt_token_handler
|
|||||||
if (!strcmp(token_handlers[i].h->name, type))
|
if (!strcmp(token_handlers[i].h->name, type))
|
||||||
return token_handlers[i].h;
|
return token_handlers[i].h;
|
||||||
|
|
||||||
|
if (i >= LUKS2_TOKENS_MAX)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
if (is_builtin_candidate(type))
|
if (is_builtin_candidate(type))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
return crypt_token_load_external(type);
|
token_handlers[i].h = crypt_token_load_external(type);
|
||||||
|
|
||||||
|
return token_handlers[i].h;
|
||||||
}
|
}
|
||||||
|
|
||||||
static const crypt_token_handler
|
static const crypt_token_handler
|
||||||
|
|||||||
Reference in New Issue
Block a user