21eb16
Only in b: config.log
21eb16
diff --color -ru a/contrib/sshaide.sh b/contrib/sshaide.sh
21eb16
--- a/contrib/sshaide.sh	2016-07-25 22:56:55.000000000 +0200
21eb16
+++ b/contrib/sshaide.sh	2021-05-20 11:11:24.112542472 +0200
21eb16
@@ -260,7 +260,7 @@
21eb16
     _randword=`grep -n . ${_wordlist} | grep "^${_linenum}:" | cut -d: -f2`
21eb16
  
21eb16
     # If $_randword has anything other than lower-case chars, try again
21eb16
-    (echo ${_randword} | LC_ALL=C grep '[^a-z]' 2>&1 >> /dev/null \
21eb16
+    ({ echo ${_randword} | LC_ALL=C grep '[^a-z]' 2>&1; } >> /dev/null \
21eb16
             && gen_rand_word ) || \
21eb16
  
21eb16
     # Return the word
21eb16
diff --color -ru a/src/commandconf.c b/src/commandconf.c
21eb16
--- a/src/commandconf.c	2021-05-20 10:37:53.842382143 +0200
21eb16
+++ b/src/commandconf.c	2021-05-25 14:16:43.278526146 +0200
21eb16
@@ -313,7 +313,7 @@
21eb16
       } else {
21eb16
 	/* gzread returns 0 even if uncompressed bytes were read*/
21eb16
 	error(240,"nread=%d,strlen(buf)=%lu,errno=%s,gzerr=%s\n",
21eb16
-              retval,(unsigned long)strnlen((char*)buf, max_size),
21eb16
+              retval,(unsigned long)strnlen((char*)buf, retval),
21eb16
               strerror(errno),gzerror(*db_gzp,&err));
21eb16
 	if(retval==0){
21eb16
 	  retval=strnlen((char*)buf, max_size);
21eb16
@@ -836,6 +836,11 @@
21eb16
       }
21eb16
       break;
21eb16
     }
21eb16
+    default: {
21eb16
+      error(0,"Unsupported dbtype.\n");
21eb16
+      free(u);
21eb16
+      break;
21eb16
+    }
21eb16
     }
21eb16
   }
21eb16
   free(val);
21eb16
@@ -900,7 +905,7 @@
21eb16
   } else {
21eb16
     error_init(u,0);
21eb16
   }
21eb16
-
21eb16
+  free(u->value);
21eb16
   free(u);  
21eb16
 }
21eb16
 
21eb16
diff --color -ru a/src/db_disk.c b/src/db_disk.c
21eb16
--- a/src/db_disk.c	2021-05-20 10:37:53.842382143 +0200
21eb16
+++ b/src/db_disk.c	2021-05-20 12:37:00.081493364 +0200
21eb16
@@ -125,10 +125,10 @@
21eb16
 
21eb16
 	ret = (char *) malloc (len);
21eb16
 	ret[0] = (char) 0;
21eb16
-	strncpy(ret, conf->root_prefix, conf->root_prefix_length+1);
21eb16
-	strncat (ret, r->path, len2);
21eb16
+	strcpy(ret, conf->root_prefix);
21eb16
+	strcat (ret, r->path);
21eb16
 	if (r->path[len2 - 1] != '/') {
21eb16
-		strncat (ret, "/", 1);
21eb16
+		strcat (ret, "/");
21eb16
 	}
21eb16
 	strcat (ret, s);
21eb16
 	return ret;
21eb16
@@ -207,8 +207,8 @@
21eb16
 	if (!root_handled) {
21eb16
 		root_handled = 1;
21eb16
 		fullname=malloc((conf->root_prefix_length+2)*sizeof(char));
21eb16
-		strncpy(fullname, conf->root_prefix, conf->root_prefix_length+1);
21eb16
-		strncat (fullname, "/", 1);
21eb16
+		strcpy(fullname, conf->root_prefix);
21eb16
+		strcat (fullname, "/");
21eb16
 		if (!get_file_status(&fullname[conf->root_prefix_length], &fs)) {
21eb16
 		add = check_rxtree (&fullname[conf->root_prefix_length], conf->tree, &attr, fs.st_mode);
21eb16
 		error (240, "%s match=%d, tree=%p, attr=%llu\n", &fullname[conf->root_prefix_length], add,
21eb16
@@ -346,8 +346,8 @@
21eb16
 				error (255, "r->childs %p, r->parent %p,r->checked %i\n",
21eb16
 							 r->childs, r->parent, r->checked);
21eb16
 				fullname=malloc((conf->root_prefix_length+strlen(r->path)+1)*sizeof(char));
21eb16
-				strncpy(fullname, conf->root_prefix, conf->root_prefix_length+1);
21eb16
-				strncat(fullname, r->path, strlen(r->path));
21eb16
+				strcpy(fullname, conf->root_prefix);
21eb16
+				strcat(fullname, r->path);
21eb16
 				dirh=open_dir(fullname);
21eb16
 				if (! dirh) {
21eb16
 
21eb16
@@ -441,8 +441,8 @@
21eb16
 
21eb16
 
21eb16
 	char* fullname=malloc((conf->root_prefix_length+2)*sizeof(char));
21eb16
-	strncpy(fullname, conf->root_prefix, conf->root_prefix_length+1);
21eb16
-	strncat (fullname, "/", 1);
21eb16
+	strcpy(fullname, conf->root_prefix);
21eb16
+	strcat (fullname, "/");
21eb16
 	dirh=open_dir(fullname);
21eb16
 	free(fullname);
21eb16
 
21eb16
diff --color -ru a/src/error.c b/src/error.c
21eb16
--- a/src/error.c	2021-05-20 10:37:53.836382037 +0200
21eb16
+++ b/src/error.c	2021-05-21 11:49:09.781313097 +0200
21eb16
@@ -125,7 +125,7 @@
21eb16
   fh=be_init(0,url,0);
21eb16
   if(fh!=NULL) {
21eb16
     conf->report_fd=list_append(conf->report_fd,(void*)fh);
21eb16
-    conf->report_url=list_append(conf->report_url,(void*)url);
21eb16
+    conf->report_url=list_append(conf->report_url,(void*)strdup(url));
21eb16
     return RETOK;
21eb16
   }
21eb16
   
21eb16
diff --color -ru a/src/util.c b/src/util.c
21eb16
--- a/src/util.c	2021-05-20 10:37:53.843382160 +0200
21eb16
+++ b/src/util.c	2021-05-25 11:04:39.507278771 +0200
21eb16
@@ -105,13 +105,15 @@
21eb16
       for(i=0;r[0]!='/'&&r[0]!='\0';r++,i++);
21eb16
       if(r[0]=='\0'){
21eb16
 	error(0,"Invalid file-URL,no path after hostname: file:%s\n",t);
21eb16
+        free(u);
21eb16
+        free(val_copy);
21eb16
         free(hostname);
21eb16
 	return NULL;
21eb16
       }
21eb16
       u->value=strdup(r);
21eb16
       r[0]='\0';
21eb16
       if(gethostname(hostname,MAXHOSTNAMELEN)==-1){
21eb16
-        strncpy(hostname,"localhost", 10);
21eb16
+        strncpy(hostname,"localhost",MAXHOSTNAMELEN);
21eb16
       }
21eb16
 
21eb16
       if( (strcmp(t,"localhost")==0)||(strcmp(t,hostname)==0)){
21eb16
@@ -119,6 +121,9 @@
21eb16
 	break;
21eb16
       } else {
21eb16
 	error(0,"Invalid file-URL, cannot use hostname other than localhost or %s: file:%s\n",hostname,u->value);
21eb16
+        free(u->value);
21eb16
+        free(u);
21eb16
+        free(val_copy);
21eb16
 	free(hostname);
21eb16
 	return NULL;
21eb16
       }
21eb16
@@ -229,6 +234,10 @@
21eb16
   int i=0;
21eb16
   
21eb16
   pc=(char*)malloc(sizeof(char)*11);
21eb16
+  if (!pc) {
21eb16
+    error(0, "Memory allocation failed.\n");
21eb16
+    return NULL;
21eb16
+  }
21eb16
   for(i=0;i<10;i++){
21eb16
     pc[i]='-';
21eb16
   }
21eb16
@@ -369,14 +378,17 @@
21eb16
 
21eb16
     if (path != NULL) {
21eb16
         if (path[0] == '~') {
21eb16
-            if((homedir=getenv("HOME")) != NULL) {
21eb16
+            if ((homedir=getenv("HOME")) != NULL) {
21eb16
                 path_len = strlen(path+sizeof(char));
21eb16
                 homedir_len = strlen(homedir);
21eb16
                 full_len = homedir_len+path_len;
21eb16
                 full = malloc(sizeof(char) * (full_len+1));
21eb16
-                strncpy(full, homedir, homedir_len);
21eb16
-                strncpy(full+homedir_len, path+sizeof(char), path_len);
21eb16
-                full[full_len] = '\0';
21eb16
+                if (!full) {
21eb16
+                    error(0, "Memory allocation failed.\n");
21eb16
+                    return path;
21eb16
+                }
21eb16
+                strcpy(full, homedir);
21eb16
+                strcat(full, path+sizeof(char));
21eb16
                 free(path);
21eb16
                 /* Don't free(homedir); because it is not safe on some platforms */
21eb16
                 path = full;