diff options
author | Christian Pointner <equinox@anytun.org> | 2008-12-28 21:27:35 +0000 |
---|---|---|
committer | Christian Pointner <equinox@anytun.org> | 2008-12-28 21:27:35 +0000 |
commit | f8b361e5bcea212fd0635df1b199b2016b14f508 (patch) | |
tree | 18e86ea8873518e3e3172fa4a7dd10dcbec57359 /src/cipher.c | |
parent | added forgotten set functions to packets (diff) |
some cleanup
Diffstat (limited to 'src/cipher.c')
-rw-r--r-- | src/cipher.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/cipher.c b/src/cipher.c index 02960e4..c473fbc 100644 --- a/src/cipher.c +++ b/src/cipher.c @@ -79,8 +79,10 @@ void cipher_set_key(cipher_t* c, u_int8_t* key, u_int32_t len) if(c->key_.buf_) free(c->key_.buf_); c->key_.buf_ = malloc(len); - if(!c->key_.buf_) + if(!c->key_.buf_) { + c->key_.buf_.length_ = 0; return; + } memcpy(c->key_.buf_, key, len); c->key_.length_ = len; } @@ -95,8 +97,10 @@ void cipher_set_salt(cipher_t* c, u_int8_t* salt, u_int32_t len) if(c->salt_.buf_) free(c->salt_.buf_); c->salt_.buf_ = malloc(len); - if(!c->salt_.buf_) + if(!c->salt_.buf_) { + c->salt_.length_ = 0; return; + } memcpy(c->salt_.buf_, salt, len); c->salt_.length_ = len; } |