summaryrefslogtreecommitdiffstats
path: root/src/blowfish.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2019-04-27 22:06:37 +0200
committerBram Moolenaar <Bram@vim.org>2019-04-27 22:06:37 +0200
commit6ee9658774942f7448af700fc04df0335796a3db (patch)
tree87f99c37e22f07e73e244da78686c7e59a8457f1 /src/blowfish.c
parent00aa069db8132851a91cfc5ca7f58ef945c75c73 (diff)
patch 8.1.1219: not checking for NULL return from alloc()v8.1.1219
Problem: Not checking for NULL return from alloc(). Solution: Add checks. (Martin Kunev, closes #4303, closes #4174)
Diffstat (limited to 'src/blowfish.c')
-rw-r--r--src/blowfish.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/blowfish.c b/src/blowfish.c
index 7bc3e31d35..ce49957913 100644
--- a/src/blowfish.c
+++ b/src/blowfish.c
@@ -636,7 +636,7 @@ crypt_blowfish_decode(
}
}
- void
+ int
crypt_blowfish_init(
cryptstate_T *state,
char_u* key,
@@ -647,6 +647,8 @@ crypt_blowfish_init(
{
bf_state_T *bfs = (bf_state_T *)alloc_clear(sizeof(bf_state_T));
+ if (bfs == NULL)
+ return FAIL;
state->method_state = bfs;
/* "blowfish" uses a 64 byte buffer, causing it to repeat 8 byte groups 8
@@ -654,10 +656,12 @@ crypt_blowfish_init(
bfs->cfb_len = state->method_nr == CRYPT_M_BF ? BF_MAX_CFB_LEN : BF_BLOCK;
if (blowfish_self_test() == FAIL)
- return;
+ return FAIL;
bf_key_init(bfs, key, salt, salt_len);
bf_cfb_init(bfs, seed, seed_len);
+
+ return OK;
}
/*