mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-06-12 01:41:36 +00:00
fix: V-002 security vulnerability
Automated security fix generated by Orbis Security AI
This commit is contained in:
parent
f63e9f3a80
commit
9da2ad7eba
1 changed files with 6 additions and 1 deletions
|
|
@ -140,7 +140,12 @@ secp256k1_context* secp256k1_context_preallocated_create(void* prealloc, unsigne
|
||||||
|
|
||||||
secp256k1_context* secp256k1_context_create(unsigned int flags) {
|
secp256k1_context* secp256k1_context_create(unsigned int flags) {
|
||||||
size_t const prealloc_size = secp256k1_context_preallocated_size(flags);
|
size_t const prealloc_size = secp256k1_context_preallocated_size(flags);
|
||||||
secp256k1_context* ctx = (secp256k1_context*)checked_malloc(&default_error_callback, prealloc_size);
|
secp256k1_context* ctx;
|
||||||
|
|
||||||
|
if (prealloc_size == 0) {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
ctx = (secp256k1_context*)checked_malloc(&default_error_callback, prealloc_size);
|
||||||
if (EXPECT(secp256k1_context_preallocated_create(ctx, flags) == NULL, 0)) {
|
if (EXPECT(secp256k1_context_preallocated_create(ctx, flags) == NULL, 0)) {
|
||||||
free(ctx);
|
free(ctx);
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue