|
|
11423e |
diff -up ./include/be.h.coverity ./include/be.h
|
|
|
11423e |
--- ./include/be.h.coverity 2016-07-25 22:56:55.000000000 +0200
|
|
|
11423e |
+++ ./include/be.h 2018-10-10 19:27:18.680632681 +0200
|
|
|
11423e |
@@ -22,6 +22,6 @@
|
|
|
11423e |
#define _BE_H_INCLUDED
|
|
|
11423e |
#include "db_config.h"
|
|
|
11423e |
|
|
|
11423e |
-FILE* be_init(int inout,url_t* u,int iszipped);
|
|
|
11423e |
+void* be_init(int inout,url_t* u,int iszipped);
|
|
|
11423e |
|
|
|
11423e |
#endif /* _BE_H_INCLUDED */
|
|
|
11423e |
diff -up ./include/db_config.h.coverity ./include/db_config.h
|
|
|
11423e |
--- ./include/db_config.h.coverity 2018-10-10 19:27:18.672632611 +0200
|
|
|
11423e |
+++ ./include/db_config.h 2018-10-10 19:27:18.681632689 +0200
|
|
|
11423e |
@@ -376,7 +376,7 @@ typedef struct db_config {
|
|
|
11423e |
#endif
|
|
|
11423e |
|
|
|
11423e |
url_t* initial_report_url;
|
|
|
11423e |
- FILE* initial_report_fd;
|
|
|
11423e |
+ void* initial_report_fd;
|
|
|
11423e |
|
|
|
11423e |
/* report_url is a list of url_t*s */
|
|
|
11423e |
list* report_url;
|
|
|
11423e |
diff -up ./src/aide.c.coverity ./src/aide.c
|
|
|
11423e |
--- ./src/aide.c.coverity 2018-10-10 19:27:18.678632663 +0200
|
|
|
11423e |
+++ ./src/aide.c 2018-10-10 19:27:18.681632689 +0200
|
|
|
11423e |
@@ -278,7 +278,7 @@ static void setdefaults_before_config()
|
|
|
11423e |
error(0,_("Couldn't get hostname"));
|
|
|
11423e |
free(s);
|
|
|
11423e |
} else {
|
|
|
11423e |
- s=(char*)realloc((void*)s,strlen(s)+1);
|
|
|
11423e |
+ // s=(char*)realloc((void*)s,strlen(s)+1);
|
|
|
11423e |
do_define("HOSTNAME",s);
|
|
|
11423e |
}
|
|
|
11423e |
|
|
|
11423e |
@@ -506,8 +506,6 @@ static void setdefaults_after_config()
|
|
|
11423e |
int main(int argc,char**argv)
|
|
|
11423e |
{
|
|
|
11423e |
int errorno=0;
|
|
|
11423e |
- byte* dig=NULL;
|
|
|
11423e |
- char* digstr=NULL;
|
|
|
11423e |
|
|
|
11423e |
#ifdef USE_LOCALE
|
|
|
11423e |
setlocale(LC_ALL,"");
|
|
|
11423e |
@@ -544,6 +542,10 @@ int main(int argc,char**argv)
|
|
|
11423e |
}
|
|
|
11423e |
|
|
|
11423e |
errorno=commandconf('C',conf->config_file);
|
|
|
11423e |
+ if (errorno==RETFAIL){
|
|
|
11423e |
+ error(0,_("Configuration error\n"));
|
|
|
11423e |
+ exit(INVALID_CONFIGURELINE_ERROR);
|
|
|
11423e |
+ }
|
|
|
11423e |
|
|
|
11423e |
errorno=commandconf('D',"");
|
|
|
11423e |
if (errorno==RETFAIL){
|
|
|
11423e |
@@ -594,6 +596,9 @@ int main(int argc,char**argv)
|
|
|
11423e |
}
|
|
|
11423e |
}
|
|
|
11423e |
#ifdef WITH_MHASH
|
|
|
11423e |
+ byte* dig=NULL;
|
|
|
11423e |
+ char* digstr=NULL;
|
|
|
11423e |
+
|
|
|
11423e |
if(conf->config_check&&FORCECONFIGMD){
|
|
|
11423e |
error(0,"Can't give config checksum when compiled with --enable-forced_configmd\n");
|
|
|
11423e |
exit(INVALID_ARGUMENT_ERROR);
|
|
|
11423e |
diff -up ./src/base64.c.coverity ./src/base64.c
|
|
|
11423e |
--- ./src/base64.c.coverity 2016-07-25 22:56:55.000000000 +0200
|
|
|
11423e |
+++ ./src/base64.c 2018-10-10 19:27:18.681632689 +0200
|
|
|
11423e |
@@ -209,6 +209,7 @@ byte* decode_base64(char* src,size_t ssi
|
|
|
11423e |
case FAIL:
|
|
|
11423e |
error(3, "decode_base64: Illegal character: %c\n", *inb);
|
|
|
11423e |
error(230, "decode_base64: Illegal line:\n%s\n", src);
|
|
|
11423e |
+ free(outbuf);
|
|
|
11423e |
return NULL;
|
|
|
11423e |
break;
|
|
|
11423e |
case SKIP:
|
|
|
11423e |
@@ -260,7 +261,7 @@ size_t length_base64(char* src,size_t ss
|
|
|
11423e |
int l;
|
|
|
11423e |
int left;
|
|
|
11423e |
size_t pos;
|
|
|
11423e |
- unsigned long triple;
|
|
|
11423e |
+ //unsigned long triple;
|
|
|
11423e |
|
|
|
11423e |
error(235, "decode base64\n");
|
|
|
11423e |
/* Exit on empty input */
|
|
|
11423e |
@@ -273,7 +274,7 @@ size_t length_base64(char* src,size_t ss
|
|
|
11423e |
inb = src;
|
|
|
11423e |
|
|
|
11423e |
l = 0;
|
|
|
11423e |
- triple = 0;
|
|
|
11423e |
+ //triple = 0;
|
|
|
11423e |
pos=0;
|
|
|
11423e |
left = ssize;
|
|
|
11423e |
/*
|
|
|
11423e |
@@ -293,7 +294,7 @@ size_t length_base64(char* src,size_t ss
|
|
|
11423e |
case SKIP:
|
|
|
11423e |
break;
|
|
|
11423e |
default:
|
|
|
11423e |
- triple = triple<<6 | (0x3f & i);
|
|
|
11423e |
+ //triple = triple<<6 | (0x3f & i);
|
|
|
11423e |
l++;
|
|
|
11423e |
break;
|
|
|
11423e |
}
|
|
|
11423e |
@@ -302,10 +303,10 @@ size_t length_base64(char* src,size_t ss
|
|
|
11423e |
switch(l)
|
|
|
11423e |
{
|
|
|
11423e |
case 2:
|
|
|
11423e |
- triple = triple>>4;
|
|
|
11423e |
+ //triple = triple>>4;
|
|
|
11423e |
break;
|
|
|
11423e |
case 3:
|
|
|
11423e |
- triple = triple>>2;
|
|
|
11423e |
+ //triple = triple>>2;
|
|
|
11423e |
break;
|
|
|
11423e |
default:
|
|
|
11423e |
break;
|
|
|
11423e |
@@ -314,7 +315,7 @@ size_t length_base64(char* src,size_t ss
|
|
|
11423e |
{
|
|
|
11423e |
pos++;
|
|
|
11423e |
}
|
|
|
11423e |
- triple = 0;
|
|
|
11423e |
+ //triple = 0;
|
|
|
11423e |
l = 0;
|
|
|
11423e |
}
|
|
|
11423e |
inb++;
|
|
|
11423e |
diff -up ./src/be.c.coverity ./src/be.c
|
|
|
11423e |
--- ./src/be.c.coverity 2016-07-25 22:56:55.000000000 +0200
|
|
|
11423e |
+++ ./src/be.c 2018-10-10 19:27:18.681632689 +0200
|
|
|
11423e |
@@ -117,9 +117,9 @@ static char* get_first_value(char** in){
|
|
|
11423e |
|
|
|
11423e |
#endif
|
|
|
11423e |
|
|
|
11423e |
-FILE* be_init(int inout,url_t* u,int iszipped)
|
|
|
11423e |
+void* be_init(int inout,url_t* u,int iszipped)
|
|
|
11423e |
{
|
|
|
11423e |
- FILE* fh=NULL;
|
|
|
11423e |
+ void* fh=NULL;
|
|
|
11423e |
long a=0;
|
|
|
11423e |
char* err=NULL;
|
|
|
11423e |
int fd;
|
|
|
11423e |
diff -up ./src/commandconf.c.coverity ./src/commandconf.c
|
|
|
11423e |
--- ./src/commandconf.c.coverity 2016-07-25 22:56:55.000000000 +0200
|
|
|
11423e |
+++ ./src/commandconf.c 2018-10-10 19:27:18.682632698 +0200
|
|
|
11423e |
@@ -106,7 +106,7 @@ int commandconf(const char mode,const ch
|
|
|
11423e |
rv=0;
|
|
|
11423e |
} else {
|
|
|
11423e |
|
|
|
11423e |
- rv=access(config,R_OK);
|
|
|
11423e |
+ if (config != NULL) rv=access(config,R_OK);
|
|
|
11423e |
if(rv==-1){
|
|
|
11423e |
error(0,_("Cannot access config file: %s: %s\n"),config,strerror(errno));
|
|
|
11423e |
}
|
|
|
11423e |
@@ -166,14 +166,11 @@ int commandconf(const char mode,const ch
|
|
|
11423e |
int conf_input_wrapper(char* buf, int max_size, FILE* in)
|
|
|
11423e |
{
|
|
|
11423e |
int retval=0;
|
|
|
11423e |
- int c=0;
|
|
|
11423e |
- char* tmp=NULL;
|
|
|
11423e |
- void* key=NULL;
|
|
|
11423e |
- int keylen=0;
|
|
|
11423e |
|
|
|
11423e |
/* FIXME Add support for gzipped config. :) */
|
|
|
11423e |
#ifdef WITH_MHASH
|
|
|
11423e |
/* Read a character at a time until we are doing md */
|
|
|
11423e |
+ int c=0;
|
|
|
11423e |
if(conf->do_configmd){
|
|
|
11423e |
retval=fread(buf,1,max_size,in);
|
|
|
11423e |
}else {
|
|
|
11423e |
@@ -185,6 +182,9 @@ int conf_input_wrapper(char* buf, int ma
|
|
|
11423e |
#endif
|
|
|
11423e |
|
|
|
11423e |
#ifdef WITH_MHASH
|
|
|
11423e |
+ char* tmp=NULL;
|
|
|
11423e |
+ void* key=NULL;
|
|
|
11423e |
+ int keylen=0;
|
|
|
11423e |
if(conf->do_configmd||conf->config_check){
|
|
|
11423e |
if(((conf->do_configmd==1)&&conf->config_check)||!conf->confmd){
|
|
|
11423e |
if(conf->do_configmd==1){
|
|
|
11423e |
@@ -276,6 +276,9 @@ int db_input_wrapper(char* buf, int max_
|
|
|
11423e |
#endif
|
|
|
11423e |
break;
|
|
|
11423e |
}
|
|
|
11423e |
+ default: {
|
|
|
11423e |
+ return 0;
|
|
|
11423e |
+ }
|
|
|
11423e |
}
|
|
|
11423e |
|
|
|
11423e |
#ifdef WITH_CURL
|
|
|
11423e |
@@ -651,7 +654,6 @@ int handle_endif(int doit,int allow_else
|
|
|
11423e |
case 0 : {
|
|
|
11423e |
conferror("@@endif or @@else expected");
|
|
|
11423e |
return -1;
|
|
|
11423e |
- count=0;
|
|
|
11423e |
}
|
|
|
11423e |
|
|
|
11423e |
default : {
|
|
|
11423e |
@@ -816,6 +818,7 @@ void do_dbdef(int dbtype,char* val)
|
|
|
11423e |
if(u==NULL||u->type==url_unknown||u->type==url_stdout
|
|
|
11423e |
||u->type==url_stderr) {
|
|
|
11423e |
error(0,_("Unsupported input URL-type:%s\n"),val);
|
|
|
11423e |
+ free(u);
|
|
|
11423e |
}
|
|
|
11423e |
else {
|
|
|
11423e |
*conf_db_url=u;
|
|
|
11423e |
@@ -825,6 +828,7 @@ void do_dbdef(int dbtype,char* val)
|
|
|
11423e |
case DB_WRITE: {
|
|
|
11423e |
if(u==NULL||u->type==url_unknown||u->type==url_stdin){
|
|
|
11423e |
error(0,_("Unsupported output URL-type:%s\n"),val);
|
|
|
11423e |
+ free(u);
|
|
|
11423e |
}
|
|
|
11423e |
else{
|
|
|
11423e |
conf->db_out_url=u;
|
|
|
11423e |
@@ -848,6 +852,7 @@ void do_dbindef(char* val)
|
|
|
11423e |
if(u==NULL||u->type==url_unknown||u->type==url_stdout
|
|
|
11423e |
||u->type==url_stderr) {
|
|
|
11423e |
error(0,_("Unsupported input URL-type:%s\n"),val);
|
|
|
11423e |
+ free(u);
|
|
|
11423e |
}
|
|
|
11423e |
else {
|
|
|
11423e |
conf->db_in_url=u;
|
|
|
11423e |
@@ -869,6 +874,7 @@ void do_dboutdef(char* val)
|
|
|
11423e |
* both input and output urls */
|
|
|
11423e |
if(u==NULL||u->type==url_unknown||u->type==url_stdin){
|
|
|
11423e |
error(0,_("Unsupported output URL-type:%s\n"),val);
|
|
|
11423e |
+ free(u);
|
|
|
11423e |
}
|
|
|
11423e |
else{
|
|
|
11423e |
conf->db_out_url=u;
|
|
|
11423e |
@@ -894,7 +900,8 @@ void do_repurldef(char* val)
|
|
|
11423e |
} else {
|
|
|
11423e |
error_init(u,0);
|
|
|
11423e |
}
|
|
|
11423e |
-
|
|
|
11423e |
+
|
|
|
11423e |
+ free(u);
|
|
|
11423e |
}
|
|
|
11423e |
|
|
|
11423e |
void do_verbdef(char* val)
|
|
|
11423e |
@@ -984,7 +991,7 @@ void do_report_ignore_e2fsattrs(char* va
|
|
|
11423e |
break;
|
|
|
11423e |
}
|
|
|
11423e |
}
|
|
|
11423e |
- *val++;
|
|
|
11423e |
+ val++;
|
|
|
11423e |
}
|
|
|
11423e |
}
|
|
|
11423e |
#endif
|
|
|
11423e |
diff -up ./src/compare_db.c.coverity ./src/compare_db.c
|
|
|
11423e |
--- ./src/compare_db.c.coverity 2018-10-10 19:27:18.673632619 +0200
|
|
|
11423e |
+++ ./src/compare_db.c 2018-10-10 19:27:18.682632698 +0200
|
|
|
11423e |
@@ -312,7 +312,7 @@ static int acl2array(acl_type* acl, char
|
|
|
11423e |
if (conf->syslog_format) {
|
|
|
11423e |
*values = malloc(2 * sizeof(char*));
|
|
|
11423e |
|
|
|
11423e |
- char *A, *D = "<NONE>";
|
|
|
11423e |
+ char *A= "<NONE>", *D = "<NONE>";
|
|
|
11423e |
|
|
|
11423e |
if (acl->acl_a) { A = acl->acl_a; }
|
|
|
11423e |
if (acl->acl_d) { D = acl->acl_d; }
|
|
|
11423e |
diff -up ./src/conf_lex.l.coverity ./src/conf_lex.l
|
|
|
11423e |
--- ./src/conf_lex.l.coverity 2018-10-10 19:27:18.673632619 +0200
|
|
|
11423e |
+++ ./src/conf_lex.l 2018-10-10 19:27:18.682632698 +0200
|
|
|
11423e |
@@ -133,7 +133,7 @@ int var_in_conflval=0;
|
|
|
11423e |
<EXPR>[\ \t]*\n {
|
|
|
11423e |
conf_lineno++;
|
|
|
11423e |
return (TNEWLINE);
|
|
|
11423e |
- BEGIN 0;
|
|
|
11423e |
+// BEGIN 0;
|
|
|
11423e |
}
|
|
|
11423e |
|
|
|
11423e |
<EXPR>\+ {
|
|
|
11423e |
diff -up ./src/db.c.coverity ./src/db.c
|
|
|
11423e |
--- ./src/db.c.coverity 2016-07-25 22:56:55.000000000 +0200
|
|
|
11423e |
+++ ./src/db.c 2018-10-10 19:27:18.683632707 +0200
|
|
|
11423e |
@@ -27,6 +27,7 @@
|
|
|
11423e |
#include "db_file.h"
|
|
|
11423e |
#include "db_disk.h"
|
|
|
11423e |
#include "md.h"
|
|
|
11423e |
+#include "fopen.h"
|
|
|
11423e |
|
|
|
11423e |
#ifdef WITH_PSQL
|
|
|
11423e |
#include "db_sql.h"
|
|
|
11423e |
@@ -269,6 +270,9 @@ db_line* db_readline(int db){
|
|
|
11423e |
db_order=&(conf->db_new_order);
|
|
|
11423e |
break;
|
|
|
11423e |
}
|
|
|
11423e |
+ default: {
|
|
|
11423e |
+ return NULL;
|
|
|
11423e |
+ }
|
|
|
11423e |
}
|
|
|
11423e |
|
|
|
11423e |
switch (db_url->type) {
|
|
|
11423e |
@@ -368,7 +372,7 @@ db_line* db_char2line(char** ss,int db){
|
|
|
11423e |
|
|
|
11423e |
int i;
|
|
|
11423e |
db_line* line=(db_line*)malloc(sizeof(db_line)*1);
|
|
|
11423e |
- int* db_osize=0;
|
|
|
11423e |
+ int* db_osize=NULL;
|
|
|
11423e |
DB_FIELD** db_order=NULL;
|
|
|
11423e |
|
|
|
11423e |
switch (db) {
|
|
|
11423e |
@@ -382,6 +386,10 @@ db_line* db_char2line(char** ss,int db){
|
|
|
11423e |
db_order=&(conf->db_new_order);
|
|
|
11423e |
break;
|
|
|
11423e |
}
|
|
|
11423e |
+ default: {
|
|
|
11423e |
+ free(line);
|
|
|
11423e |
+ return NULL;
|
|
|
11423e |
+ }
|
|
|
11423e |
}
|
|
|
11423e |
|
|
|
11423e |
|
|
|
11423e |
@@ -601,7 +609,9 @@ db_line* db_char2line(char** ss,int db){
|
|
|
11423e |
size_t vsz = 0;
|
|
|
11423e |
|
|
|
11423e |
tval = strtok(NULL, ",");
|
|
|
11423e |
- line->xattrs->ents[num].key = db_readchar(strdup(tval));
|
|
|
11423e |
+ char * tmp = strdup(tval);
|
|
|
11423e |
+ line->xattrs->ents[num].key = db_readchar(tmp);
|
|
|
11423e |
+ free(tmp);
|
|
|
11423e |
tval = strtok(NULL, ",");
|
|
|
11423e |
val = base64tobyte(tval, strlen(tval), &vsz;;
|
|
|
11423e |
line->xattrs->ents[num].val = val;
|
|
|
11423e |
@@ -648,6 +658,8 @@ db_line* db_char2line(char** ss,int db){
|
|
|
11423e |
|
|
|
11423e |
default : {
|
|
|
11423e |
error(0,_("Not implemented in db_char2line %i \n"),(*db_order)[i]);
|
|
|
11423e |
+ free_db_line(line);
|
|
|
11423e |
+ free(line);
|
|
|
11423e |
return NULL;
|
|
|
11423e |
}
|
|
|
11423e |
|
|
|
11423e |
@@ -826,7 +838,7 @@ void db_close() {
|
|
|
11423e |
case url_ftp:
|
|
|
11423e |
{
|
|
|
11423e |
if (conf->db_out!=NULL) {
|
|
|
11423e |
- url_fclose(conf->db_out);
|
|
|
11423e |
+ url_fclose((URL_FILE*)conf->db_out);
|
|
|
11423e |
}
|
|
|
11423e |
break;
|
|
|
11423e |
}
|
|
|
11423e |
diff -up ./src/db_disk.c.coverity ./src/db_disk.c
|
|
|
11423e |
--- ./src/db_disk.c.coverity 2016-07-25 22:56:55.000000000 +0200
|
|
|
11423e |
+++ ./src/db_disk.c 2018-10-10 19:28:00.108995089 +0200
|
|
|
11423e |
@@ -79,9 +79,15 @@ static DIR *open_dir(char* path) {
|
|
|
11423e |
|
|
|
11423e |
static void next_in_dir (void)
|
|
|
11423e |
{
|
|
|
11423e |
+
|
|
|
11423e |
#ifdef HAVE_READDIR_R
|
|
|
11423e |
- if (dirh != NULL)
|
|
|
11423e |
+ if (dirh != NULL) {
|
|
|
11423e |
+#pragma GCC diagnostic push
|
|
|
11423e |
+#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
|
|
|
11423e |
rdres = AIDE_READDIR_R_FUNC (dirh, entp, resp);
|
|
|
11423e |
+#pragma GCC diagnostic pop
|
|
|
11423e |
+ }
|
|
|
11423e |
+
|
|
|
11423e |
#else
|
|
|
11423e |
#ifdef HAVE_READDIR
|
|
|
11423e |
if (dirh != NULL) {
|
|
|
11423e |
diff -up ./src/db_file.c.coverity ./src/db_file.c
|
|
|
11423e |
--- ./src/db_file.c.coverity 2016-07-25 22:56:55.000000000 +0200
|
|
|
11423e |
+++ ./src/db_file.c 2018-10-10 19:27:18.683632707 +0200
|
|
|
11423e |
@@ -171,7 +171,7 @@ int dofprintf( const char* s,...)
|
|
|
11423e |
int db_file_read_spec(int db){
|
|
|
11423e |
|
|
|
11423e |
int i=0;
|
|
|
11423e |
- int* db_osize=0;
|
|
|
11423e |
+ int* db_osize=NULL;
|
|
|
11423e |
DB_FIELD** db_order=NULL;
|
|
|
11423e |
|
|
|
11423e |
switch (db) {
|
|
|
11423e |
@@ -187,6 +187,9 @@ int db_file_read_spec(int db){
|
|
|
11423e |
db_lineno=&db_new_lineno;
|
|
|
11423e |
break;
|
|
|
11423e |
}
|
|
|
11423e |
+ default: {
|
|
|
11423e |
+ return RETFAIL;
|
|
|
11423e |
+ }
|
|
|
11423e |
}
|
|
|
11423e |
|
|
|
11423e |
*db_order=(DB_FIELD*) malloc(1*sizeof(DB_FIELD));
|
|
|
11423e |
@@ -198,13 +201,10 @@ int db_file_read_spec(int db){
|
|
|
11423e |
int l;
|
|
|
11423e |
|
|
|
11423e |
|
|
|
11423e |
- /* Yes... we do not check if realloc returns nonnull */
|
|
|
11423e |
-
|
|
|
11423e |
- *db_order=(DB_FIELD*)
|
|
|
11423e |
- realloc((void*)*db_order,
|
|
|
11423e |
+ void * tmp = realloc((void*)*db_order,
|
|
|
11423e |
((*db_osize)+1)*sizeof(DB_FIELD));
|
|
|
11423e |
-
|
|
|
11423e |
- if(*db_order==NULL){
|
|
|
11423e |
+ if (tmp != NULL) *db_order=(DB_FIELD*) tmp;
|
|
|
11423e |
+ else {
|
|
|
11423e |
return RETFAIL;
|
|
|
11423e |
}
|
|
|
11423e |
|
|
|
11423e |
@@ -291,8 +291,8 @@ char** db_readline_file(int db){
|
|
|
11423e |
int* domd=NULL;
|
|
|
11423e |
#ifdef WITH_MHASH
|
|
|
11423e |
MHASH* md=NULL;
|
|
|
11423e |
-#endif
|
|
|
11423e |
char** oldmdstr=NULL;
|
|
|
11423e |
+#endif
|
|
|
11423e |
int* db_osize=0;
|
|
|
11423e |
DB_FIELD** db_order=NULL;
|
|
|
11423e |
FILE** db_filep=NULL;
|
|
|
11423e |
@@ -302,9 +302,9 @@ char** db_readline_file(int db){
|
|
|
11423e |
case DB_OLD: {
|
|
|
11423e |
#ifdef WITH_MHASH
|
|
|
11423e |
md=&(conf->dboldmd);
|
|
|
11423e |
+ oldmdstr=&(conf->old_dboldmdstr);
|
|
|
11423e |
#endif
|
|
|
11423e |
domd=&(conf->do_dboldmd);
|
|
|
11423e |
- oldmdstr=&(conf->old_dboldmdstr);
|
|
|
11423e |
|
|
|
11423e |
db_osize=&(conf->db_in_size);
|
|
|
11423e |
db_order=&(conf->db_in_order);
|
|
|
11423e |
@@ -316,9 +316,9 @@ char** db_readline_file(int db){
|
|
|
11423e |
case DB_NEW: {
|
|
|
11423e |
#ifdef WITH_MHASH
|
|
|
11423e |
md=&(conf->dbnewmd);
|
|
|
11423e |
+ oldmdstr=&(conf->old_dbnewmdstr);
|
|
|
11423e |
#endif
|
|
|
11423e |
domd=&(conf->do_dbnewmd);
|
|
|
11423e |
- oldmdstr=&(conf->old_dbnewmdstr);
|
|
|
11423e |
|
|
|
11423e |
db_osize=&(conf->db_new_size);
|
|
|
11423e |
db_order=&(conf->db_new_order);
|
|
|
11423e |
@@ -328,7 +328,9 @@ char** db_readline_file(int db){
|
|
|
11423e |
break;
|
|
|
11423e |
}
|
|
|
11423e |
}
|
|
|
11423e |
-
|
|
|
11423e |
+
|
|
|
11423e |
+ if (db_osize == NULL) return NULL;
|
|
|
11423e |
+
|
|
|
11423e |
if (*db_osize==0) {
|
|
|
11423e |
db_buff(db,*db_filep);
|
|
|
11423e |
|
|
|
11423e |
@@ -737,8 +739,6 @@ int db_writespec_file(db_config* dbconf)
|
|
|
11423e |
int i=0;
|
|
|
11423e |
int j=0;
|
|
|
11423e |
int retval=1;
|
|
|
11423e |
- void*key=NULL;
|
|
|
11423e |
- int keylen=0;
|
|
|
11423e |
struct tm* st;
|
|
|
11423e |
time_t tim=time(&tim);
|
|
|
11423e |
st=localtime(&tim);
|
|
|
11423e |
@@ -750,6 +750,8 @@ int db_writespec_file(db_config* dbconf)
|
|
|
11423e |
|
|
|
11423e |
#ifdef WITH_MHASH
|
|
|
11423e |
/* From hereon everything must MD'd before write to db */
|
|
|
11423e |
+ void*key=NULL;
|
|
|
11423e |
+ int keylen=0;
|
|
|
11423e |
if((key=get_db_key())!=NULL){
|
|
|
11423e |
keylen=get_db_key_len();
|
|
|
11423e |
dbconf->do_dbnewmd=1;
|
|
|
11423e |
diff -up ./src/do_md.c.coverity ./src/do_md.c
|
|
|
11423e |
--- ./src/do_md.c.coverity 2016-07-25 22:56:55.000000000 +0200
|
|
|
11423e |
+++ ./src/do_md.c 2018-10-10 19:27:18.683632707 +0200
|
|
|
11423e |
@@ -202,7 +202,6 @@ void calc_md(struct AIDE_STAT_TYPE* old_
|
|
|
11423e |
and we don't read from a pipe :)
|
|
|
11423e |
*/
|
|
|
11423e |
struct AIDE_STAT_TYPE fs;
|
|
|
11423e |
- int sres=0;
|
|
|
11423e |
int stat_diff,filedes;
|
|
|
11423e |
#ifdef WITH_PRELINK
|
|
|
11423e |
pid_t pid;
|
|
|
11423e |
@@ -237,7 +236,7 @@ void calc_md(struct AIDE_STAT_TYPE* old_
|
|
|
11423e |
return;
|
|
|
11423e |
}
|
|
|
11423e |
|
|
|
11423e |
- sres=AIDE_FSTAT_FUNC(filedes,&fs);
|
|
|
11423e |
+ AIDE_FSTAT_FUNC(filedes,&fs);
|
|
|
11423e |
if(!(line->attr&DB_RDEV))
|
|
|
11423e |
fs.st_rdev=0;
|
|
|
11423e |
|
|
|
11423e |
@@ -331,7 +330,7 @@ void calc_md(struct AIDE_STAT_TYPE* old_
|
|
|
11423e |
}
|
|
|
11423e |
#endif
|
|
|
11423e |
#endif /* not HAVE_MMAP */
|
|
|
11423e |
- buf=malloc(READ_BLOCK_SIZE);
|
|
|
11423e |
+// buf=malloc(READ_BLOCK_SIZE);
|
|
|
11423e |
#if READ_BLOCK_SIZE>SSIZE_MAX
|
|
|
11423e |
#error "READ_BLOCK_SIZE" is too large. Max value is SSIZE_MAX, and current is READ_BLOCK_SIZE
|
|
|
11423e |
#endif
|
|
|
11423e |
diff -up ./src/gen_list.c.coverity ./src/gen_list.c
|
|
|
11423e |
--- ./src/gen_list.c.coverity 2016-07-25 22:56:55.000000000 +0200
|
|
|
11423e |
+++ ./src/gen_list.c 2018-10-10 19:27:18.684632716 +0200
|
|
|
11423e |
@@ -843,15 +843,15 @@ static void add_file_to_tree(seltree* tr
|
|
|
11423e |
DB_ATTR_TYPE localignorelist=0;
|
|
|
11423e |
DB_ATTR_TYPE ignored_added_attrs, ignored_removed_attrs, ignored_changed_attrs;
|
|
|
11423e |
|
|
|
11423e |
+ if(file==NULL){
|
|
|
11423e |
+ error(0, "add_file_to_tree was called with NULL db_line\n");
|
|
|
11423e |
+ }
|
|
|
11423e |
+
|
|
|
11423e |
node=get_seltree_node(tree,file->filename);
|
|
|
11423e |
|
|
|
11423e |
if(!node){
|
|
|
11423e |
node=new_seltree_node(tree,file->filename,0,NULL);
|
|
|
11423e |
}
|
|
|
11423e |
-
|
|
|
11423e |
- if(file==NULL){
|
|
|
11423e |
- error(0, "add_file_to_tree was called with NULL db_line\n");
|
|
|
11423e |
- }
|
|
|
11423e |
|
|
|
11423e |
/* add note to this node which db has modified it */
|
|
|
11423e |
node->checked|=db;
|
|
|
11423e |
diff -up ./src/md.c.coverity ./src/md.c
|
|
|
11423e |
--- ./src/md.c.coverity 2018-10-10 19:27:18.679632672 +0200
|
|
|
11423e |
+++ ./src/md.c 2018-10-10 19:27:18.684632716 +0200
|
|
|
11423e |
@@ -36,8 +36,8 @@
|
|
|
11423e |
*/
|
|
|
11423e |
|
|
|
11423e |
DB_ATTR_TYPE hash_gcrypt2attr(int i) {
|
|
|
11423e |
- DB_ATTR_TYPE r=0;
|
|
|
11423e |
#ifdef WITH_GCRYPT
|
|
|
11423e |
+ DB_ATTR_TYPE r=0;
|
|
|
11423e |
switch (i) {
|
|
|
11423e |
case GCRY_MD_MD5: {
|
|
|
11423e |
r=DB_MD5;
|
|
|
11423e |
@@ -74,13 +74,15 @@ DB_ATTR_TYPE hash_gcrypt2attr(int i) {
|
|
|
11423e |
default:
|
|
|
11423e |
break;
|
|
|
11423e |
}
|
|
|
11423e |
-#endif
|
|
|
11423e |
return r;
|
|
|
11423e |
+#else /* !WITH_GCRYPT */
|
|
|
11423e |
+ return 0;
|
|
|
11423e |
+#endif
|
|
|
11423e |
}
|
|
|
11423e |
|
|
|
11423e |
const char * hash_gcrypt2str(int i) {
|
|
|
11423e |
- char * r = "?";
|
|
|
11423e |
#ifdef WITH_GCRYPT
|
|
|
11423e |
+ char * r = "?";
|
|
|
11423e |
switch (i) {
|
|
|
11423e |
case GCRY_MD_MD5: {
|
|
|
11423e |
r = "MD5";
|
|
|
11423e |
@@ -117,13 +119,17 @@ const char * hash_gcrypt2str(int i) {
|
|
|
11423e |
default:
|
|
|
11423e |
break;
|
|
|
11423e |
}
|
|
|
11423e |
-#endif
|
|
|
11423e |
return r;
|
|
|
11423e |
+#else /* !WITH_GCRYPT */
|
|
|
11423e |
+ return "?";
|
|
|
11423e |
+#endif
|
|
|
11423e |
}
|
|
|
11423e |
|
|
|
11423e |
+#pragma GCC diagnostic push
|
|
|
11423e |
+#pragma GCC diagnostic ignored "-Wunused-parameter"
|
|
|
11423e |
DB_ATTR_TYPE hash_mhash2attr(int i) {
|
|
|
11423e |
- DB_ATTR_TYPE r=0;
|
|
|
11423e |
#ifdef WITH_MHASH
|
|
|
11423e |
+ DB_ATTR_TYPE r=0;
|
|
|
11423e |
switch (i) {
|
|
|
11423e |
case MHASH_CRC32: {
|
|
|
11423e |
r=DB_CRC32;
|
|
|
11423e |
@@ -198,10 +204,15 @@ DB_ATTR_TYPE hash_mhash2attr(int i) {
|
|
|
11423e |
default:
|
|
|
11423e |
break;
|
|
|
11423e |
}
|
|
|
11423e |
-#endif
|
|
|
11423e |
+
|
|
|
11423e |
return r;
|
|
|
11423e |
+#else /*!WITH_MHASH */
|
|
|
11423e |
+ return 0;
|
|
|
11423e |
+#endif
|
|
|
11423e |
}
|
|
|
11423e |
|
|
|
11423e |
+#pragma GCC diagnostic pop
|
|
|
11423e |
+
|
|
|
11423e |
/*
|
|
|
11423e |
Initialise md_container according it's todo_attr field
|
|
|
11423e |
*/
|
|
|
11423e |
@@ -317,7 +328,6 @@ int init_md(struct md_container* md) {
|
|
|
11423e |
*/
|
|
|
11423e |
|
|
|
11423e |
int update_md(struct md_container* md,void* data,ssize_t size) {
|
|
|
11423e |
- int i;
|
|
|
11423e |
|
|
|
11423e |
error(255,"update_md called\n");
|
|
|
11423e |
|
|
|
11423e |
@@ -328,6 +338,7 @@ int update_md(struct md_container* md,vo
|
|
|
11423e |
#endif
|
|
|
11423e |
|
|
|
11423e |
#ifdef WITH_MHASH
|
|
|
11423e |
+ int i;
|
|
|
11423e |
|
|
|
11423e |
for(i=0;i<=HASH_MHASH_COUNT;i++) {
|
|
|
11423e |
if (md->mhash_mdh[i]!=MHASH_FAILED) {
|
|
|
11423e |
@@ -348,7 +359,6 @@ int update_md(struct md_container* md,vo
|
|
|
11423e |
*/
|
|
|
11423e |
|
|
|
11423e |
int close_md(struct md_container* md) {
|
|
|
11423e |
- int i;
|
|
|
11423e |
#ifdef _PARAMETER_CHECK_
|
|
|
11423e |
if (md==NULL) {
|
|
|
11423e |
return RETFAIL;
|
|
|
11423e |
@@ -356,6 +366,7 @@ int close_md(struct md_container* md) {
|
|
|
11423e |
#endif
|
|
|
11423e |
error(255,"close_md called \n");
|
|
|
11423e |
#ifdef WITH_MHASH
|
|
|
11423e |
+ int i;
|
|
|
11423e |
for(i=0;i<=HASH_MHASH_COUNT;i++) {
|
|
|
11423e |
if (md->mhash_mdh[i]!=MHASH_FAILED) {
|
|
|
11423e |
mhash (md->mhash_mdh[i], NULL, 0);
|
|
|
11423e |
diff -up ./src/util.c.coverity ./src/util.c
|
|
|
11423e |
--- ./src/util.c.coverity 2018-10-10 19:27:18.670632593 +0200
|
|
|
11423e |
+++ ./src/util.c 2018-10-10 19:27:18.684632716 +0200
|
|
|
11423e |
@@ -105,13 +105,15 @@ url_t* parse_url(char* val)
|
|
|
11423e |
for(i=0;r[0]!='/'&&r[0]!='\0';r++,i++);
|
|
|
11423e |
if(r[0]=='\0'){
|
|
|
11423e |
error(0,"Invalid file-URL,no path after hostname: file:%s\n",t);
|
|
|
11423e |
+ free(hostname);
|
|
|
11423e |
return NULL;
|
|
|
11423e |
}
|
|
|
11423e |
u->value=strdup(r);
|
|
|
11423e |
r[0]='\0';
|
|
|
11423e |
if(gethostname(hostname,MAXHOSTNAMELEN)==-1){
|
|
|
11423e |
- strncpy(hostname,"localhost", 10);
|
|
|
11423e |
+ strncpy(hostname,"localhost", 10);
|
|
|
11423e |
}
|
|
|
11423e |
+
|
|
|
11423e |
if( (strcmp(t,"localhost")==0)||(strcmp(t,hostname)==0)){
|
|
|
11423e |
free(hostname);
|
|
|
11423e |
break;
|
|
|
11423e |
@@ -120,7 +122,7 @@ url_t* parse_url(char* val)
|
|
|
11423e |
free(hostname);
|
|
|
11423e |
return NULL;
|
|
|
11423e |
}
|
|
|
11423e |
- free(hostname);
|
|
|
11423e |
+
|
|
|
11423e |
break;
|
|
|
11423e |
}
|
|
|
11423e |
u->value=strdup(r);
|