Fixes for several errors found by Coverity. [rt17160]

This commit is contained in:
Evan Hunt
2007-09-24 17:18:25 +00:00
parent a3edcadfff
commit 8327cdb88f
6 changed files with 22 additions and 16 deletions

View File

@@ -1,5 +1,5 @@
#ifndef LINT
static const char rcsid[] = "$Header: /u0/home/explorer/proj/ISC/git-conversion/cvsroot/bind9/lib/bind/dst/Attic/dst_api.c,v 1.16 2007/08/27 03:32:26 marka Exp $";
static const char rcsid[] = "$Header: /u0/home/explorer/proj/ISC/git-conversion/cvsroot/bind9/lib/bind/dst/Attic/dst_api.c,v 1.17 2007/09/24 17:18:25 each Exp $";
#endif
/*
@@ -434,6 +434,7 @@ dst_s_write_private_key(const DST_KEY *key)
if ((nn = fwrite(encoded_block, 1, len, fp)) != len) {
EREPORT(("dst_write_private_key(): Write failure on %s %d != %d errno=%d\n",
file, len, nn, errno));
fclose(fp);
return (-5);
}
fclose(fp);

View File

@@ -1,6 +1,6 @@
#ifdef HMAC_MD5
#ifndef LINT
static const char rcsid[] = "$Header: /u0/home/explorer/proj/ISC/git-conversion/cvsroot/bind9/lib/bind/dst/Attic/hmac_link.c,v 1.7 2007/02/26 01:51:43 marka Exp $";
static const char rcsid[] = "$Header: /u0/home/explorer/proj/ISC/git-conversion/cvsroot/bind9/lib/bind/dst/Attic/hmac_link.c,v 1.8 2007/09/24 17:18:25 each Exp $";
#endif
/*
* Portions Copyright (c) 1995-1998 by Trusted Information Systems, Inc.
@@ -223,6 +223,7 @@ dst_buffer_to_hmac_md5(DST_KEY *dkey, const u_char *key, const int keylen)
HMAC_Key *hkey = NULL;
MD5_CTX ctx;
int local_keylen = keylen;
u_char tk[MD5_LEN];
if (dkey == NULL || key == NULL || keylen < 0)
return (-1);
@@ -235,7 +236,6 @@ dst_buffer_to_hmac_md5(DST_KEY *dkey, const u_char *key, const int keylen)
/* if key is longer than HMAC_LEN bytes reset it to key=MD5(key) */
if (keylen > HMAC_LEN) {
u_char tk[MD5_LEN];
MD5Init(&ctx);
MD5Update(&ctx, key, keylen);
MD5Final(tk, &ctx);