1
0
mirror of https://git.FreeBSD.org/ports.git synced 2024-12-28 05:29:48 +00:00
freebsd-ports/www/sarg/files/patch-report.c
Renato Botelho bd65726682 - Fix a segmentation fault when you are using authentication and have a user
named "log"
- Bump PORTREVISION

Obtained from:	Sarg bugtracker
2007-06-11 11:25:32 +00:00

31 lines
934 B
C

--- report.c.orig Tue Jan 2 17:11:26 2007
+++ report.c Fri Jun 8 08:13:13 2007
@@ -46,6 +46,7 @@
long long int incache=0;
long long int oucache=0;
char *s;
+ char *haystack;
DIR *dirp;
struct dirent *direntp;
@@ -73,7 +74,9 @@
dirp = opendir(tmp);
while ((direntp = readdir( dirp )) != NULL ) {
- if((strstr(direntp->d_name,".log") == 0) ||
+ haystack=direntp->d_name;
+ haystack+=(strlen(haystack)-5);
+ if((strstr(haystack,".log") == 0) ||
(strncmp(direntp->d_name,"download.log",12) == 0) ||
(strncmp(direntp->d_name,"denied.log",10) == 0) ||
(strncmp(direntp->d_name,"authfail.log.unsort",19) == 0))
@@ -89,7 +92,7 @@
getword(wname2,wdname,'.');
strcat(user,wname2);
- if(strcmp(wdname,"log") !=0) {
+ if((strcmp(wdname,"log")!=0) || (strlen(wdname)>3)) {
strcat(user,".");
goto strip_prefix;
}