Sanity check update patches submitted by Bill Parker

pull/27/head
Mickey Sola 10 years ago
parent 5f1ada67a3
commit 637d246131
  1. 4
      clamav-milter/clamav-milter.c
  2. 4
      clamd/clamd.c
  3. 6
      clamd/onaccess_ddd.c
  4. 2
      clamd/onaccess_hash.c
  5. 4
      clamdtop/clamdtop.c
  6. 4
      shared/misc.c

@ -99,6 +99,10 @@ int main(int argc, char **argv) {
}
pt = strdup(optget(opts, "config-file")->strarg);
if (pt == NULL) {
printf("Unable to allocate memory for config file\n");
return 1;
}
if((opts = optparse(pt, 0, NULL, 1, OPT_MILTER, 0, opts)) == NULL) {
printf("%s: cannot parse config file %s\n", argv[0], pt);
free(pt);

@ -164,6 +164,10 @@ int main(int argc, char **argv)
/* parse the config file */
cfgfile = optget(opts, "config-file")->strarg;
pt = strdup(cfgfile);
if (pt == NULL) {
fprintf(stderr, "ERROR: Unable to allocate memory for config file\n");
return 1;
}
if((opts = optparse(cfgfile, 0, NULL, 1, OPT_CLAMD, 0, opts)) == NULL) {
fprintf(stderr, "ERROR: Can't open/parse the config file %s\n", pt);
free(pt);

@ -182,6 +182,8 @@ static int onas_ddd_watch_hierarchy(const char* pathname, size_t len, int fd, ui
size_t size = len + strlen(curr->dirname) + 2;
char *child_path = (char *) cli_malloc(size);
if (child_path == NULL)
return CL_EMEM;
if (hnode->pathname[len-1] == '/')
snprintf(child_path, --size, "%s%s", hnode->pathname, curr->dirname);
else
@ -247,6 +249,8 @@ static int onas_ddd_unwatch_hierarchy(const char* pathname, size_t len, int fd,
size_t size = len + strlen(curr->dirname) + 2;
char *child_path = (char *) cli_malloc(size);
if (child_path == NULL)
return CL_EMEM;
if (hnode->pathname[len-1] == '/')
snprintf(child_path, --size, "%s%s", hnode->pathname, curr->dirname);
else
@ -378,6 +382,8 @@ void *onas_ddd_th(void *arg) {
len = strlen(path);
size_t size = strlen(child) + len + 2;
char *child_path = (char *) cli_malloc(size);
if (child_path == NULL)
return CL_EMEM;
if (path[len-1] == '/')
snprintf(child_path, --size, "%s%s", path, child);
else

@ -629,6 +629,8 @@ int onas_ht_rm_hierarchy(struct onas_ht *ht, const char* pathname, size_t len, i
size_t size = len + strlen(curr->dirname) + 2;
char *child_path = (char *) cli_malloc(size);
if (child_path == NULL)
return CL_EMEM;
if (hnode->pathname[len-1] == '/')
snprintf(child_path, size, "%s%s", hnode->pathname, curr->dirname);
else

@ -618,6 +618,7 @@ static int make_connection_real(const char *soname, conn_t *conn)
struct addrinfo hints, *res=NULL, *p;
int err;
OOM_CHECK(pt);
conn->tcp = 0;
#ifndef _WIN32
@ -1088,11 +1089,13 @@ static void parse_stats(conn_t *conn, struct stats *stats, unsigned idx)
if (!conn->version) {
stats->engine_version = strdup("???");
OOM_CHECK(stats->engine_version);
return;
}
p = pstart = vstart = strchr(conn->version, ' ');
if (!vstart) {
stats->engine_version = strdup("???");
OOM_CHECK(stats->engine_version);
return;
}
/* find digit in version */
@ -1116,6 +1119,7 @@ static void parse_stats(conn_t *conn, struct stats *stats, unsigned idx)
pstart = strchr(p, '/');
if (!pstart)
stats->db_version = strdup("????");
OOM_CHECK(stats->db_version);
else {
pstart++;
p = strchr(pstart, '/');

@ -79,6 +79,10 @@ char *freshdbdir(void)
if((opt = optget(opts, "DatabaseDirectory"))->enabled) {
if(strcmp(dbdir, opt->strarg)) {
char *daily = (char *) malloc(strlen(opt->strarg) + strlen(dbdir) + 30);
if (daily == NULL) {
fprintf(stderr, "Unable to allocate memory for db directory...\n");
return NULL;
}
sprintf(daily, "%s"PATHSEP"daily.cvd", opt->strarg);
if(access(daily, R_OK))
sprintf(daily, "%s"PATHSEP"daily.cld", opt->strarg);

Loading…
Cancel
Save