Fix CIDs 12008, 12007, 12005, 12002, 12001, 11787, 11774, and 11724

This commit is contained in:
Shawn Webb
2014-02-24 14:20:35 -05:00
parent d799631e45
commit 4d0353424f
5 changed files with 14 additions and 11 deletions

View File

@@ -595,7 +595,7 @@ static int make_connection_real(const char *soname, conn_t *conn)
{
int s;
struct timeval tv;
char *port;
char *port=NULL;
char *name, *pt = strdup(soname);
const char *host = pt;
struct addrinfo hints, *res=NULL, *p;

View File

@@ -591,28 +591,24 @@ unsigned char *cl_sign_data(EVP_PKEY *pkey, char *alg, unsigned char *hash, unsi
sig = (unsigned char *)calloc(1, EVP_PKEY_size(pkey));
if (!(sig)) {
free(hash);
EVP_MD_CTX_destroy(ctx);
return NULL;
}
if (!EVP_SignInit_ex(ctx, md, NULL)) {
free(sig);
free(hash);
EVP_MD_CTX_destroy(ctx);
return NULL;
}
if (!EVP_SignUpdate(ctx, hash, EVP_MD_size(md))) {
free(sig);
free(hash);
EVP_MD_CTX_destroy(ctx);
return NULL;
}
if (!EVP_SignFinal(ctx, sig, &siglen, pkey)) {
free(sig);
free(hash);
EVP_MD_CTX_destroy(ctx);
return NULL;
}
@@ -621,7 +617,6 @@ unsigned char *cl_sign_data(EVP_PKEY *pkey, char *alg, unsigned char *hash, unsi
unsigned char *newsig = (unsigned char *)cl_base64_encode(sig, siglen);
if (!(newsig)) {
free(sig);
free(hash);
EVP_MD_CTX_destroy(ctx);
return NULL;
}
@@ -741,9 +736,9 @@ int cl_validate_certificate_chain_ts_dir(char *tsdir, char *certpath)
while (nauths > 0)
free(authorities[nauths--]);
free(authorities[0]);
free(authorities);
}
free(authorities);
closedir(dp);
return -1;
}
@@ -922,7 +917,7 @@ struct tm *cl_ASN1_GetTimeT(ASN1_TIME *timeobj)
struct tm *t;
char* str;
size_t i = 0;
const char *fmt;
const char *fmt=NULL;
time_t localt;
#ifdef _WIN32
struct tm localtm, *ltm;
@@ -962,6 +957,11 @@ struct tm *cl_ASN1_GetTimeT(ASN1_TIME *timeobj)
}
}
if (!(fmt)) {
free(t);
return NULL;
}
if (!strptime(str, fmt, t)) {
free(t);
return NULL;

View File

@@ -297,11 +297,13 @@ int cli_scandmg(cli_ctx *ctx)
if (ret == CL_EFORMAT) {
/* Didn't decode, or not a mish block */
ret = CL_CLEAN;
free(mish_set);
xmlFree(nodeName);
continue;
}
else if (ret != CL_CLEAN) {
xmlFree(nodeName);
free(mish_set);
continue;
}
/* Add mish block to list */

View File

@@ -1304,6 +1304,7 @@ static int cli_scanscript(cli_ctx *ctx)
if(!(normalized = cli_malloc(SCANBUFF + maxpatlen))) {
cli_dbgmsg("cli_scanscript: Unable to malloc %u bytes\n", SCANBUFF);
free(tmpname);
return CL_EMEM;
}
@@ -1318,12 +1319,14 @@ static int cli_scanscript(cli_ctx *ctx)
ret = cli_ac_caloff(troot, &tmdata, &info);
if (ret) {
cli_ac_freedata(&tmdata);
free(tmpname);
return ret;
}
}
if ((ret = cli_ac_initdata(&gmdata, groot->ac_partsigs, groot->ac_lsigs, groot->ac_reloff_num, CLI_DEFAULT_AC_TRACKLEN))) {
cli_ac_freedata(&tmdata);
free(tmpname);
return ret;
}
mdata[0] = &tmdata;
@@ -3076,7 +3079,7 @@ int cli_map_scan(cl_fmap_t *map, off_t offset, size_t length, cli_ctx *ctx, cli_
ret = cli_base_scandesc(fd, ctx, type);
/* remove the temp file, if needed */
if (fd > -1) {
if (fd >= 0) {
close(fd);
}
if(!ctx->engine->keeptmp) {

View File

@@ -585,8 +585,6 @@ char *clamav_stats_get_hostid(void *cbdata)
return strdup(STATS_ANON_UUID);
return buf;
#endif
return strdup(STATS_ANON_UUID);
}
#endif