projects
/
silc.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
38fc611
)
malloc checks.
author
Pekka Riikonen
<priikone@silcnet.org>
Sun, 22 Apr 2007 18:18:52 +0000
(18:18 +0000)
committer
Pekka Riikonen
<priikone@silcnet.org>
Sun, 22 Apr 2007 18:18:52 +0000
(18:18 +0000)
lib/silccrypt/silccipher.c
patch
|
blob
|
history
diff --git
a/lib/silccrypt/silccipher.c
b/lib/silccrypt/silccipher.c
index ee722690356263061f8b04078ad169468296f2e4..efb4b76a396712f8ce9c989ac3eb6ee6da303239 100644
(file)
--- a/
lib/silccrypt/silccipher.c
+++ b/
lib/silccrypt/silccipher.c
@@
-95,7
+95,13
@@
SilcBool silc_cipher_register(const SilcCipherObject *cipher)
}
new = silc_calloc(1, sizeof(*new));
}
new = silc_calloc(1, sizeof(*new));
+ if (!new)
+ return FALSE;
new->name = strdup(cipher->name);
new->name = strdup(cipher->name);
+ if (!new->name) {
+ silc_free(new);
+ return FALSE;
+ }
new->key_len = cipher->key_len;
new->block_len = cipher->block_len;
new->iv_len = cipher->iv_len;
new->key_len = cipher->key_len;
new->block_len = cipher->block_len;
new->iv_len = cipher->iv_len;
@@
-215,8
+221,14
@@
SilcBool silc_cipher_alloc(const unsigned char *name, SilcCipher *new_cipher)
if (entry) {
*new_cipher = silc_calloc(1, sizeof(**new_cipher));
if (entry) {
*new_cipher = silc_calloc(1, sizeof(**new_cipher));
+ if (!(*new_cipher))
+ return FALSE;
(*new_cipher)->cipher = entry;
(*new_cipher)->context = silc_calloc(1, entry->context_len());
(*new_cipher)->cipher = entry;
(*new_cipher)->context = silc_calloc(1, entry->context_len());
+ if (!(*new_cipher)->context) {
+ silc_free(*new_cipher);
+ return FALSE;
+ }
return TRUE;
}
return TRUE;
}