File sarg-2.2.5-getword_boundary_limit.patch of Package sarg

--- sarg-2.2.5/auth.c.orig	2008-03-03 23:08:01.000000000 +0100
+++ sarg-2.2.5/auth.c	2008-04-21 17:43:50.000000000 +0200
@@ -39,7 +39,7 @@ void htaccess(char *name)
    }
 
    strcpy(warea,Require);
-   getword(buf,warea,'%');
+   getword(buf,sizeof(buf),warea,'%');
    fputs("AuthUserFile ",fp_auth);
    fputs(AuthUserFile,fp_auth);
    fputs("\n",fp_auth);
--- sarg-2.2.5/authfail.c.orig	2008-03-03 23:08:01.000000000 +0100
+++ sarg-2.2.5/authfail.c	2008-04-21 17:44:49.000000000 +0200
@@ -113,11 +113,11 @@ void authfail_report()
    fputs(url,fp_ou);
 
    while(fgets(buf,sizeof(buf),fp_in)!=NULL) {
-      getword(data,buf,' ');
-      getword(hora,buf,' ');
-      getword(user,buf,' ');
-      getword(ip,buf,' ');
-      getword(url,buf,' ');
+      getword(data,sizeof(data),buf,' ');
+      getword(hora,sizeof(hora),buf,' ');
+      getword(user,sizeof(user),buf,' ');
+      getword(ip,sizeof(ip),buf,' ');
+      getword(url,sizeof(url),buf,' ');
 
       if((str=(char *) strstr(user, "_")) != (char *) NULL ) {
          if((str=(char *) strstr(str+1, "_")) != (char *) NULL )
--- sarg-2.2.5/convlog.c.orig	2008-04-21 17:05:25.000000000 +0200
+++ sarg-2.2.5/convlog.c	2008-04-21 17:45:21.000000000 +0200
@@ -47,7 +47,7 @@ void convlog(char *arq, char *df, int df
    }
 
    while(fgets(buf,sizeof(buf),fp_in)!=NULL) {
-      getword(data,buf,' ');
+      getword(data,sizeof(data),buf,' ');
       tt=atoi(data);
       t=localtime(&tt);
 
--- sarg-2.2.5/dansguardian_log.c.orig	2008-03-03 23:08:01.000000000 +0100
+++ sarg-2.2.5/dansguardian_log.c	2008-04-21 17:47:44.000000000 +0200
@@ -97,16 +97,16 @@ int dansguardian_log()
       if(strncmp(buf,"#",1) == 0)
          continue;
       if(strstr(buf,"loglocation ") != 0) {
-         getword(loglocation,buf,'\'');
-         getword(loglocation,buf,'\'');
+         getword(loglocation,sizeof(loglocation),buf,'\'');
+         getword(loglocation,sizeof(loglocation),buf,'\'');
          break;
       }
    }
 
    if(debug) {
       strcpy(buf,text[7]);
-      getword(urly,buf,' ');
-      getword(href,buf,' ');
+      getword(urly,sizeof(urly),buf,' ');
+      getword(href,sizeof(href),buf,' ');
       sprintf(msg,"%s DansGuardian %s: %s",urly,buf,loglocation);
       debuga(msg);
    }
@@ -119,18 +119,18 @@ int dansguardian_log()
    while(fgets(buf,sizeof(buf),fp_in) != NULL) {
       if(strstr(buf," *DENIED* ") == 0)
          continue;
-      getword(year,buf,'.');
-      getword(mon,buf,'.');
-      getword(day,buf,' ');
-      getword(hour,buf,' ');
-      getword(user,buf,' ');
-      getword(ip,buf,' ');
-      getword(url,buf,'/');
-      getword(url,buf,'/');
-      getword(url,buf,' ');
-      getword(code1,buf,' ');
-      getword(code1,buf,' ');
-      getword(code2,buf,' ');
+      getword(year,sizeof(year),buf,'.');
+      getword(mon,sizeof(year),buf,'.');
+      getword(day,sizeof(day),buf,' ');
+      getword(hour,sizeof(hour),buf,' ');
+      getword(user,sizeof(user),buf,' ');
+      getword(ip,sizeof(ip),buf,' ');
+      getword(url,sizeof(url),buf,'/');
+      getword(url,sizeof(url),buf,'/');
+      getword(url,sizeof(url),buf,' ');
+      getword(code1,sizeof(code1),buf,' ');
+      getword(code1,sizeof(code1),buf,' ');
+      getword(code2,sizeof(code2),buf,' ');
       sprintf(wdata,"%s%02d%s",year,atoi(mon),day);
       idata = atoi(wdata);
 
--- sarg-2.2.5/dansguardian_report.c.orig	2008-03-03 23:08:01.000000000 +0100
+++ sarg-2.2.5/dansguardian_report.c	2008-04-21 17:50:18.000000000 +0200
@@ -107,12 +107,12 @@ void dansguardian_report()
    fputs(url,fp_ou);
 
    while(fgets(buf,sizeof(buf),fp_in)!=NULL) {
-      getword(user,buf,' ');
-      getword(date2,buf,' ');
-      getword(hour,buf,' ');
-      getword(ip,buf,' ');
-      getword(url,buf,' ');
-      getword(rule,buf,'\n');
+      getword(user,sizeof(user),buf,' ');
+      getword(date2,sizeof(date2),buf,' ');
+      getword(hour,sizeof(hour),buf,' ');
+      getword(ip,sizeof(ip),buf,' ');
+      getword(url,sizeof(url),buf,' ');
+      getword(rule,sizeof(rule),buf,'\n');
 
       if(strcmp(UserIp,"yes") == 0)
            strcpy(user,ip);
--- sarg-2.2.5/datafile.c.orig	2008-03-03 23:08:01.000000000 +0100
+++ sarg-2.2.5/datafile.c	2008-04-21 17:50:29.000000000 +0200
@@ -71,21 +71,21 @@ void data_file(char *tmp)
       }
       strcpy(wdname,direntp->d_name);
       strip_prefix:
-      getword(wname2,wdname,'.');
+      getword(wname2,sizeof(wname2),wdname,'.');
       strcat(user,wname2);
 
       ttopen=0;
       while(fgets(buf,sizeof(buf),fp_in)!=NULL) {
-         getword(accdia,buf,' ');
-         getword(acchora,buf,' ');
-         getword(accuser,buf,' ');
-         getword(accip,buf,' ');
-         getword(accurl,buf,' ');
-         getword(accbytes,buf,' ');
-         getword(acccode,buf,' ');
-         getword(accelap,buf,' ');
-         getword(accsmart,buf,' ');
-         getword(accsmart,buf,'"');
+         getword(accdia,sizeof(accdia),buf,' ');
+         getword(acchora,sizeof(acchora),buf,' ');
+         getword(accuser,sizeof(accuser),buf,' ');
+         getword(accip,sizeof(accip),buf,' ');
+         getword(accurl,sizeof(accurl),buf,' ');
+         getword(accbytes,sizeof(accbytes),buf,' ');
+         getword(acccode,sizeof(acccode),buf,' ');
+         getword(accelap,sizeof(accelap),buf,' ');
+         getword(accsmart,sizeof(accsmart),buf,' ');
+         getword(accsmart,sizeof(accsmart),buf,'"');
    
          if(strcmp(Ip2Name,"yes") == 0) {
             if(strcmp(accip,ipantes) != 0) {
@@ -127,7 +127,7 @@ void data_file(char *tmp)
          nelap+=my_atoll(accelap);
    
          strcpy(wcrc,acccode);
-         getword(crc2,wcrc,'/');
+         getword(crc2,sizeof(crc2),wcrc,'/');
 
          if(strstr(crc2,"MISS") != 0) oucache+=my_atoll(accbytes);
          else incache+=my_atoll(accbytes);
--- sarg-2.2.5/denied.c.orig	2008-03-03 23:08:01.000000000 +0100
+++ sarg-2.2.5/denied.c	2008-04-21 17:50:41.000000000 +0200
@@ -103,11 +103,11 @@ void gen_denied_report()
    fputs(url,fp_ou);
 
    while(fgets(buf,sizeof(buf),fp_in)!=NULL) {
-      getword(data,buf,' ');
-      getword(hora,buf,' ');
-      getword(user,buf,' ');
-      getword(ip,buf,' ');
-      getword(url,buf,' ');
+      getword(data,sizeof(data),buf,' ');
+      getword(hora,sizeof(hora),buf,' ');
+      getword(user,sizeof(user),buf,' ');
+      getword(ip,sizeof(ip),buf,' ');
+      getword(url,sizeof(url),buf,' ');
 
       if((str=(char *) strstr(user, "_")) != (char *) NULL ) {
          if((str=(char *) strstr(str+1, "_")) != (char *) NULL )
--- sarg-2.2.5/download.c.orig	2008-03-03 23:08:01.000000000 +0100
+++ sarg-2.2.5/download.c	2008-04-21 17:50:49.000000000 +0200
@@ -110,11 +110,11 @@ void download_report()
    fputs(url,fp_ou);
 
    while(fgets(buf,sizeof(buf),fp_in)!=NULL) {
-      getword(data,buf,' ');
-      getword(hora,buf,' ');
-      getword(user,buf,' ');
-      getword(ip,buf,' ');
-      getword(url,buf,' ');
+      getword(data,sizeof(data),buf,' ');
+      getword(hora,sizeof(hora),buf,' ');
+      getword(user,sizeof(user),buf,' ');
+      getword(ip,sizeof(ip),buf,' ');
+      getword(url,sizeof(url),buf,' ');
   
       if((str=(char *) strstr(user, "_")) != (char *) NULL ) {
          if((str=(char *) strstr(str+1, "_")) != (char *) NULL )
--- sarg-2.2.5/exclude.c.orig	2008-03-03 23:08:01.000000000 +0100
+++ sarg-2.2.5/exclude.c	2008-04-21 17:51:14.000000000 +0200
@@ -46,10 +46,10 @@ int vhexclude(char *excludefile, char *u
    strcpy(str,excludefile);
    strcpy(wurl,url);
 
-   getword(whost,str,' ');
+   getword(whost,sizeof(whost),str,' ');
    
    if(strchr(wurl,':') != 0) {
-      getword(warea,wurl,':');
+      getword(warea,sizeof(warea),wurl,':');
       strcpy(wurl,warea);
    }
 
@@ -60,15 +60,15 @@ int vhexclude(char *excludefile, char *u
          return(0);
       }
       if(strchr(whost,'*') != 0) {
-         getword(warea,whost,'.');
-         getword(warea,wurl,'.');
+         getword(warea,sizeof(warea),whost,'.');
+         getword(warea,sizeof(warea),wurl,'.');
          if(strcmp(wurl,whost) == 0) {
 	    free(wurl);
 	    free(str);
             return(0);
 	 }
       }
-      getword(whost,str,' ');
+      getword(whost,sizeof(whost),str,' ');
    }
    free(wurl);
    free(str);
--- sarg-2.2.5/getconf.c.orig	2008-03-03 23:08:01.000000000 +0100
+++ sarg-2.2.5/getconf.c	2008-04-21 17:51:20.000000000 +0200
@@ -34,7 +34,7 @@ void parmtest(char *buf)
 {
 
       if(strstr(buf,"background_color") != 0) {
-         getword(wbuf,buf,' ');
+         getword(wbuf,sizeof(wbuf),buf,' ');
          strcpy(BgColor,buf);
          fixnone(BgColor);
          return;
@@ -42,7 +42,7 @@ void parmtest(char *buf)
 
       if(strstr(buf,"text_color") != 0) {
          if(strstr(buf,"logo_text_color") == 0) {
-            getword(wbuf,buf,' ');
+            getword(wbuf,sizeof(wbuf),buf,' ');
             strcpy(TxColor,buf);
             fixnone(TxColor);
             return;
@@ -50,21 +50,21 @@ void parmtest(char *buf)
       }
 
       if(strstr(buf,"text_bgcolor") != 0) {
-         getword(wbuf,buf,' ');
+         getword(wbuf,sizeof(wbuf),buf,' ');
          strcpy(TxBgColor,buf);
          fixnone(TxBgColor);
          return;
       }
 
       if(strstr(buf,"title_color") != 0) {
-         getword(wbuf,buf,' ');
+         getword(wbuf,sizeof(wbuf),buf,' ');
          strcpy(TiColor,buf);
          fixnone(TiColor);
          return;
       }
 
       if(strstr(buf,"logo_image") != 0) {
-         getword(wbuf,buf,' ');
+         getword(wbuf,sizeof(wbuf),buf,' ');
          strcpy(LogoImage,buf);
          fixnone(LogoImage);
          return;
@@ -72,57 +72,57 @@ void parmtest(char *buf)
 
       if(strstr(buf,"logo_text") != 0) {
          if(strstr(buf,"logo_text_color") == 0) {
-            getword(wbuf,buf,'"');
-            getword(LogoText,buf,'"');
+            getword(wbuf,sizeof(wbuf),buf,'"');
+            getword(LogoText,sizeof(LogoText),buf,'"');
             fixnone(LogoText);
             return;
          }
       }
 
       if(strstr(buf,"logo_text_color") != 0) {
-         getword(wbuf,buf,' ');
+         getword(wbuf,sizeof(wbuf),buf,' ');
          strcpy(LogoTextColor,buf);
          fixnone(LogoTextColor);
          return;
       }
 
       if(strstr(buf,"background_image") != 0) {
-         getword(wbuf,buf,' ');
+         getword(wbuf,sizeof(wbuf),buf,' ');
          strcpy(BgImage,buf);
          fixnone(BgImage);
          return;
       }
 
       if(strstr(buf,"show_sarg_info") != 0) {
-         getword(wbuf,buf,' ');
+         getword(wbuf,sizeof(wbuf),buf,' ');
          strcpy(ShowSargInfo,buf);
          fixnone(ShowSargInfo);
          return;
       }
 
       if(strstr(buf,"show_sarg_logo") != 0) {
-         getword(wbuf,buf,' ');
+         getword(wbuf,sizeof(wbuf),buf,' ');
          strcpy(ShowSargLogo,buf);
          fixnone(ShowSargLogo);
          return;
       }
 
       if(strstr(buf,"font_face") != 0) {
-         getword(wbuf,buf,' ');
+         getword(wbuf,sizeof(wbuf),buf,' ');
          strcpy(FontFace,buf);
          fixnone(FontFace);
          return;
       }
 
       if(strstr(buf,"header_color") != 0) {
-         getword(wbuf,buf,' ');
+         getword(wbuf,sizeof(wbuf),buf,' ');
          strcpy(HeaderColor,buf);
          fixnone(HeaderColor);
          return;
       }
 
       if(strstr(buf,"header_bgcolor") != 0) {
-         getword(wbuf,buf,' ');
+         getword(wbuf,sizeof(wbuf),buf,' ');
          strcpy(HeaderBgColor,buf);
          fixnone(HeaderBgColor);
          return;
@@ -130,7 +130,7 @@ void parmtest(char *buf)
 
       if(strstr(buf,"font_size") != 0) {
          if(strstr(buf,"header_font_size") == 0 && strstr(buf,"title_font_size") == 0) {
-            getword(wbuf,buf,' ');
+            getword(wbuf,sizeof(wbuf),buf,' ');
             strcpy(FontSize,buf);
             fixnone(FontSize);
             return;
@@ -138,22 +138,22 @@ void parmtest(char *buf)
       }
 
       if(strstr(buf,"header_font_size") != 0) {
-         getword(wbuf,buf,' ');
+         getword(wbuf,sizeof(wbuf),buf,' ');
          strcpy(HeaderFontSize,buf);
          fixnone(HeaderFontSize);
          return;
       }
 
       if(strstr(buf,"title_font_size") != 0) {
-         getword(wbuf,buf,' ');
+         getword(wbuf,sizeof(wbuf),buf,' ');
          strcpy(TitleFontSize,buf);
          fixnone(TitleFontSize);
          return;
       }
 
       if(strstr(buf,"image_size") != 0) {
-         getword(wbuf,buf,' ');
-         getword(Width,buf,' ');
+         getword(wbuf,sizeof(wbuf),buf,' ');
+         getword(Width,sizeof(Width),buf,' ');
          strcpy(Height,buf);
          fixnone(Width);
          fixnone(Height);
@@ -161,35 +161,35 @@ void parmtest(char *buf)
       }
 
       if(strstr(buf,"title") != 0) {
-         getword(wbuf,buf,'"');
-         getword(Title,buf,'"');
+         getword(wbuf,sizeof(wbuf),buf,'"');
+         getword(Title,sizeof(Title),buf,'"');
          fixnone(Title);
          return;
       }
 
       if(strstr(buf,"resolve_ip") != 0) {
-         getword(wbuf,buf,' ');
+         getword(wbuf,sizeof(wbuf),buf,' ');
          strcpy(Ip2Name,buf);
          fixnone(Ip2Name);
          return;
       }
 
       if(strstr(buf,"user_ip") != 0) {
-         getword(wbuf,buf,' ');
+         getword(wbuf,sizeof(wbuf),buf,' ');
          strcpy(UserIp,buf);
          fixnone(UserIp);
          return;
       }
 
       if(strstr(buf,"max_elapsed") != 0) {
-         getword(wbuf,buf,' ');
+         getword(wbuf,sizeof(wbuf),buf,' ');
          strcpy(MaxElapsed,buf);
          fixnone(MaxElapsed);
          return;
       }
 
       if(strstr(buf,"date_format") != 0) {
-         getword(wbuf,buf,' ');
+         getword(wbuf,sizeof(wbuf),buf,' ');
          strncpy(DateFormat,buf,1);
          fixnone(DateFormat);
          return;
@@ -210,16 +210,16 @@ void parmtest(char *buf)
       }
 
       if(strstr(buf,"topuser_sort_field") != 0) {
-         getword(wbuf,buf,' ');
-         getword(TopuserSortField,buf,' ');
+         getword(wbuf,sizeof(wbuf),buf,' ');
+         getword(TopuserSortField,sizeof(TopuserSortField),buf,' ');
          strcpy(TopuserSortOrder,buf);
          fixnone(TopuserSortOrder);
          return;
       }
 
       if(strstr(buf,"user_sort_field") != 0) {
-         getword(wbuf,buf,' ');
-         getword(UserSortField,buf,' ');
+         getword(wbuf,sizeof(wbuf),buf,' ');
+         getword(UserSortField,sizeof(UserSortField),buf,' ');
          strcpy(UserSortOrder,buf);
          fixnone(UserSortOrder);
          return;
@@ -227,7 +227,7 @@ void parmtest(char *buf)
 
       if(strstr(buf,"access_log") != 0) {
 	 if(strstr(buf,"realtime_access_log_lines") == 0) {
-            getword(wbuf,buf,' ');
+            getword(wbuf,sizeof(wbuf),buf,' ');
             strcpy(AccessLog,buf);
             fixnone(AccessLog);
             return;
@@ -235,49 +235,49 @@ void parmtest(char *buf)
       }
 
       if(strstr(buf,"useragent_log") != 0) {
-         getword(wbuf,buf,' ');
+         getword(wbuf,sizeof(wbuf),buf,' ');
          strcpy(UserAgentLog,buf);
          fixnone(UserAgentLog);
          return;
       }
 
       if(strstr(buf,"exclude_hosts") != 0) {
-         getword(wbuf,buf,' ');
+         getword(wbuf,sizeof(wbuf),buf,' ');
          strcpy(ExcludeHosts,buf);
          fixnone(ExcludeHosts);
          return;
       }
 
       if(strstr(buf,"exclude_codes") != 0) {
-         getword(wbuf,buf,' ');
+         getword(wbuf,sizeof(wbuf),buf,' ');
          strcpy(ExcludeCodes,buf);
          fixnone(ExcludeCodes);
          return;
       }
 
       if(strstr(buf,"exclude_users") != 0) {
-         getword(wbuf,buf,' ');
+         getword(wbuf,sizeof(wbuf),buf,' ');
          strcpy(ExcludeUsers,buf);
          fixnone(ExcludeUsers);
          return;
       }
 
       if(strstr(buf,"password") != 0) {
-         getword(wbuf,buf,' ');
+         getword(wbuf,sizeof(wbuf),buf,' ');
          strcpy(PasswdFile,buf);
          fixnone(PasswdFile);
          return;
       }
 
       if(strstr(buf,"temporary_dir") != 0) {
-         getword(wbuf,buf,' ');
+         getword(wbuf,sizeof(wbuf),buf,' ');
          strcpy(TempDir,buf);
          fixnone(TempDir);
          return;
       }
 
       if(strstr(buf,"report_type") != 0) {
-         getword(wbuf,buf,' ');
+         getword(wbuf,sizeof(wbuf),buf,' ');
          strcpy(ReportType,buf);
          fixnone(ReportType);
          return;
@@ -285,7 +285,7 @@ void parmtest(char *buf)
 
       if(strstr(buf,"output_dir") != 0) {
          if(strstr(buf,"output_dir_form") == 0) {
-            getword(wbuf,buf,' ');
+            getword(wbuf,sizeof(wbuf),buf,' ');
             strcpy(OutputDir,buf);
             fixnone(OutputDir);
             return;
@@ -293,15 +293,15 @@ void parmtest(char *buf)
       }
 
       if(strstr(buf,"output_email") != 0) {
-         getword(wbuf,buf,' ');
+         getword(wbuf,sizeof(wbuf),buf,' ');
          strcpy(OutputEmail,buf);
          fixnone(OutputEmail);
          return;
       }
 
       if(strstr(buf,"per_user_limit") != 0) {
-         getword(wbuf,buf,' ');
-         getword(PerUserLimitFile,buf,' ');
+         getword(wbuf,sizeof(wbuf),buf,' ');
+         getword(PerUserLimitFile,sizeof(PerUserLimitFile),buf,' ');
          strcpy(PerUserLimit,buf);
          fixnone(PerUserLimitFile);
          fixnone(PerUserLimit);
@@ -310,28 +310,28 @@ void parmtest(char *buf)
 
 
       if(strstr(buf,"lastlog") != 0) {
-         getword(wbuf,buf,' ');
+         getword(wbuf,sizeof(wbuf),buf,' ');
          strcpy(LastLog,buf);
          fixnone(LastLog);
          return;
       }
 
       if(strstr(buf,"remove_temp_files") != 0) {
-         getword(wbuf,buf,' ');
+         getword(wbuf,sizeof(wbuf),buf,' ');
          strcpy(RemoveTempFiles,buf);
          fixnone(RemoveTempFiles);
          return;
       }
 
       if(strstr(buf,"replace_index") != 0) {
-         getword(wbuf,buf,' ');
+         getword(wbuf,sizeof(wbuf),buf,' ');
          strcpy(ReplaceIndex,buf);
          fixnone(ReplaceIndex);
          return;
       }      
 
       if(strstr(buf,"index_tree") != 0) {
-         getword(wbuf,buf,' ');
+         getword(wbuf,sizeof(wbuf),buf,' ');
          strcpy(IndexTree,buf);
          fixnone(IndexTree);
          return;
@@ -339,7 +339,7 @@ void parmtest(char *buf)
 
       if(strstr(buf,"index") != 0) {
          if(strstr(buf,"index_sort_order") == 0) {
-            getword(wbuf,buf,' ');
+            getword(wbuf,sizeof(wbuf),buf,' ');
             strcpy(Index,buf);
             fixnone(Index);
             return;
@@ -347,64 +347,64 @@ void parmtest(char *buf)
       }
 
       if(strstr(buf,"overwrite_report") != 0) {
-         getword(wbuf,buf,' ');
+         getword(wbuf,sizeof(wbuf),buf,' ');
          strcpy(OverwriteReport,buf);
          fixnone(OverwriteReport);
          return;
       }
 
       if(strstr(buf,"records_without_userid") != 0) {
-         getword(wbuf,buf,' ');
+         getword(wbuf,sizeof(wbuf),buf,' ');
          strcpy(RecordsWithoutUser,buf);
          fixnone(RecordsWithoutUser);
          return;
       }
 
       if(strstr(buf,"use_comma") != 0) {
-         getword(wbuf,buf,' ');
+         getword(wbuf,sizeof(wbuf),buf,' ');
          strcpy(UseComma,buf);
          fixnone(UseComma);
          return;
       }
 
       if(strstr(buf,"mail_utility") != 0) {
-         getword(wbuf,buf,' ');
+         getword(wbuf,sizeof(wbuf),buf,' ');
          strcpy(MailUtility,buf);
          fixnone(MailUtility);
          return;
       }
 
       if(strstr(buf,"topsites_num") != 0) {
-         getword(wbuf,buf,' ');
+         getword(wbuf,sizeof(wbuf),buf,' ');
          strcpy(TopSitesNum,buf);
          fixnone(TopSitesNum);
          return;
       }
 
       if(strstr(buf,"topuser_num") != 0) {
-         getword(wbuf,buf,' ');
+         getword(wbuf,sizeof(wbuf),buf,' ');
          strcpy(TopUsersNum,buf);
          fixnone(TopUsersNum);
          return;
       }
 
       if(strstr(buf,"usertab") != 0) {
-         getword(wbuf,buf,' ');
+         getword(wbuf,sizeof(wbuf),buf,' ');
          strcpy(UserTabFile,buf);
          fixnone(UserTabFile);
          return;
       }
 
       if(strstr(buf,"index_sort_order") != 0) {
-         getword(wbuf,buf,' ');
+         getword(wbuf,sizeof(wbuf),buf,' ');
          strcpy(IndexSortOrder,buf);
          fixnone(IndexSortOrder);
          return;
       }
 
       if(strstr(buf,"topsites_sort_order") != 0) {
-         getword(wbuf,buf,' ');
-         getword(TopsitesSortField,buf,' ');
+         getword(wbuf,sizeof(wbuf),buf,' ');
+         getword(TopsitesSortField,sizeof(TopsitesSortField),buf,' ');
          strcpy(TopsitesSortType,buf);
          fixnone(TopsitesSortField);
          fixnone(TopsitesSortType);
@@ -412,42 +412,42 @@ void parmtest(char *buf)
       }
 
       if(strstr(buf,"long_url") != 0) {
-         getword(wbuf,buf,' ');
+         getword(wbuf,sizeof(wbuf),buf,' ');
          strcpy(LongUrl,buf);
          fixnone(LongUrl);
          return;
       }
 
       if(strstr(buf,"language") != 0) {
-         getword(wbuf,buf,' ');
+         getword(wbuf,sizeof(wbuf),buf,' ');
          strcpy(language,buf);
          fixnone(language);
          return;
       }
 
       if(strstr(buf,"dansguardian_conf") != 0) {
-         getword(wbuf,buf,' ');
+         getword(wbuf,sizeof(wbuf),buf,' ');
          strcpy(DansGuardianConf,buf);
          fixnone(DansGuardianConf);
          return;
       }
 
       if(strstr(buf,"squidguard_conf") != 0) {
-         getword(wbuf,buf,' ');
+         getword(wbuf,sizeof(wbuf),buf,' ');
          strcpy(SquidGuardConf,buf);
          fixnone(SquidGuardConf);
          return;
       }
 
       if(strstr(buf,"date_time_by") != 0) {
-         getword(wbuf,buf,' ');
+         getword(wbuf,sizeof(wbuf),buf,' ');
          strcpy(datetimeby,buf);
          fixnone(datetimeby);
          return;
       }
 
       if(strstr(buf,"charset") != 0) {
-         getword(wbuf,buf,' ');
+         getword(wbuf,sizeof(wbuf),buf,' ');
          strcpy(CharSet,buf);
          fixnone(CharSet);
          ccharset(CharSet);
@@ -455,23 +455,23 @@ void parmtest(char *buf)
       }
 
       if(strstr(buf,"user_invalid_char") != 0) {
-         getword(wbuf,buf,'"');
-         getword(UserInvalidChar,buf,'"');
+         getword(wbuf,sizeof(wbuf),buf,'"');
+         getword(UserInvalidChar,sizeof(UserInvalidChar),buf,'"');
          fixnone(UserInvalidChar);
          return;
       }
 
       if(strstr(buf,"include_users") != 0) {
-         getword(wbuf,buf,'"');
-         getword(wbuf,buf,'"');
+         getword(wbuf,sizeof(wbuf),buf,'"');
+         getword(wbuf,sizeof(wbuf),buf,'"');
 	 sprintf(IncludeUsers,":%s:",wbuf);
          fixnone(IncludeUsers);
          return;
       }
 
       if(strstr(buf,"exclude_string") != 0) {
-         getword(wbuf,buf,'"');
-         getword(ExcludeString,buf,'"');
+         getword(wbuf,sizeof(wbuf),buf,'"');
+         getword(ExcludeString,sizeof(ExcludeString),buf,'"');
          fixnone(ExcludeString);
          return;
       }
@@ -479,7 +479,7 @@ void parmtest(char *buf)
       if(strstr(buf,"privacy") != 0) {
          if(strstr(buf,"privacy_string") == 0 && \
 	    strstr(buf,"privacy_string_color") == 0) {
-            getword(wbuf,buf,' ');
+            getword(wbuf,sizeof(wbuf),buf,' ');
             strcpy(Privacy,buf);
             fixnone(Privacy);
             return;
@@ -488,86 +488,86 @@ void parmtest(char *buf)
 
       if(strstr(buf,"privacy_string") != 0) {
 	 if(strstr(buf,"privacy_string_color") == 0) {
-            getword(wbuf,buf,'"');
-            getword(PrivacyString,buf,'"');
+            getword(wbuf,sizeof(wbuf),buf,'"');
+            getword(PrivacyString,sizeof(PrivacyString),buf,'"');
             fixnone(PrivacyString);
             return;
 	 }
       }
 
       if(strstr(buf,"privacy_string_color") != 0) {
-         getword(wbuf,buf,' ');
+         getword(wbuf,sizeof(wbuf),buf,' ');
          strcpy(PrivacyStringColor,buf);
          fixnone(PrivacyStringColor);
          return;
       }
 
       if(strstr(buf,"show_successful_message") != 0) {
-         getword(wbuf,buf,' ');
+         getword(wbuf,sizeof(wbuf),buf,' ');
          strcpy(SuccessfulMsg,buf);
          fixnone(SuccessfulMsg);
          return;
       }
 
       if(strstr(buf,"show_read_statistics") != 0) {
-         getword(wbuf,buf,' ');
+         getword(wbuf,sizeof(wbuf),buf,' ');
          strcpy(ShowReadStatistics,buf);
          fixnone(ShowReadStatistics);
          return;
       }
 
       if(strstr(buf,"topuser_fields") != 0) {
-         getword(wbuf,buf,' ');
+         getword(wbuf,sizeof(wbuf),buf,' ');
          strcpy(TopUserFields,buf);
          fixnone(TopUserFields);
          return;
       }
 
       if(strstr(buf,"bytes_in_sites_users_report") != 0) {
-         getword(wbuf,buf,' ');
+         getword(wbuf,sizeof(wbuf),buf,' ');
          strcpy(BytesInSitesUsersReport,buf);
          fixnone(BytesInSitesUsersReport);
          return;
       }
 
       if(strstr(buf,"user_report_fields") != 0) {
-         getword(wbuf,buf,' ');
+         getword(wbuf,sizeof(wbuf),buf,' ');
          strcpy(UserReportFields,buf);
          fixnone(UserReportFields);
          return;
       }
 
       if(strstr(buf,"bytes_in_sites_users_report") != 0) {
-         getword(wbuf,buf,' ');
+         getword(wbuf,sizeof(wbuf),buf,' ');
          strcpy(BytesInSitesUsersReport,buf);
          fixnone(BytesInSitesUsersReport);
          return;
       }
 
       if(strstr(buf,"datafile ") != 0) {
-         getword(wbuf,buf,' ');
+         getword(wbuf,sizeof(wbuf),buf,' ');
          strcpy(DataFile,buf);
          fixnone(DataFile);
          return;
       }
 
       if(strstr(buf,"datafile_delimiter") != 0) {
-         getword(wbuf,buf,' ');
-         getword(wbuf,buf,'"');
-         getword(DataFileDelimiter,buf,'"');
+         getword(wbuf,sizeof(wbuf),buf,' ');
+         getword(wbuf,sizeof(wbuf),buf,'"');
+         getword(DataFileDelimiter,sizeof(DataFileDelimiter),buf,'"');
          fixnone(DataFileDelimiter);
          return;
       }
 
       if(strstr(buf,"datafile_fields") != 0) {
-         getword(wbuf,buf,' ');
+         getword(wbuf,sizeof(wbuf),buf,' ');
          strcpy(DataFileFields,buf);
          fixnone(DataFileFields);
          return;
       }
 
       if(strstr(buf,"datafile_url") != 0) {
-         getword(wbuf,buf,' ');
+         getword(wbuf,sizeof(wbuf),buf,' ');
          strcpy(DataFileUrl,buf);
          fixnone(DataFileUrl);
          return;
@@ -575,7 +575,7 @@ void parmtest(char *buf)
 
       if(strstr(buf,"parsed_output_log") != 0) {
 	 if(strstr(buf,"parsed_output_log_compress") == 0) {
-            getword(wbuf,buf,' ');
+            getword(wbuf,sizeof(wbuf),buf,' ');
             strcpy(ParsedOutputLog,buf);
             fixnone(ParsedOutputLog);
             return;
@@ -583,195 +583,195 @@ void parmtest(char *buf)
       }
 
       if(strstr(buf,"parsed_output_log_compress") != 0) {
-         getword(wbuf,buf,' ');
+         getword(wbuf,sizeof(wbuf),buf,' ');
          strcpy(ParsedOutputLogCompress,buf);
          fixnone(ParsedOutputLogCompress);
          return;
       }
 
       if(strstr(buf,"displayed_values") != 0) {
-         getword(wbuf,buf,' ');
+         getword(wbuf,sizeof(wbuf),buf,' ');
          strcpy(DisplayedValues,buf);
          fixnone(DisplayedValues);
          return;
       }
 
       if(strstr(buf,"authfail_report_limit") != 0) {
-         getword(wbuf,buf,' ');
+         getword(wbuf,sizeof(wbuf),buf,' ');
          AuthfailReportLimit=atoi(buf);
          return;
       }
 
       if(strstr(buf,"denied_report_limit") != 0) {
-         getword(wbuf,buf,' ');
+         getword(wbuf,sizeof(wbuf),buf,' ');
          DeniedReportLimit=atoi(buf);
          return;
       }
 
       if(strstr(buf,"siteusers_report_limit") != 0) {
-         getword(wbuf,buf,' ');
+         getword(wbuf,sizeof(wbuf),buf,' ');
          SiteUsersReportLimit=atoi(buf);
          return;
       }
 
       if(strstr(buf,"dansguardian_report_limit") != 0) {
-         getword(wbuf,buf,' ');
+         getword(wbuf,sizeof(wbuf),buf,' ');
          DansGuardianReportLimit=atoi(buf);
          return;
       }
 
       if(strstr(buf,"squidguard_report_limit") != 0) {
-         getword(wbuf,buf,' ');
+         getword(wbuf,sizeof(wbuf),buf,' ');
          SquidGuardReportLimit=atoi(buf);
          return;
       }
 
       if(strstr(buf,"user_report_limit") != 0) {
-         getword(wbuf,buf,' ');
+         getword(wbuf,sizeof(wbuf),buf,' ');
          UserReportLimit=atoi(buf);
          return;
       }
 
       if(strstr(buf,"download_report_limit") != 0) {
-         getword(wbuf,buf,' ');
+         getword(wbuf,sizeof(wbuf),buf,' ');
          DownloadReportLimit=atoi(buf);
          return;
       }
 
       if(strstr(buf,"www_document_root") != 0) {
-         getword(wbuf,buf,' ');
+         getword(wbuf,sizeof(wbuf),buf,' ');
          strcpy(wwwDocumentRoot,buf);
          fixnone(wwwDocumentRoot);
          return;
       }
 
       if(strstr(buf,"block_it") != 0) {
-         getword(wbuf,buf,' ');
+         getword(wbuf,sizeof(wbuf),buf,' ');
          strcpy(BlockIt,buf);
          fixnone(BlockIt);
          return;
       }
 
       if(strstr(buf,"external_css_file") != 0) {
-         getword(wbuf,buf,' ');
+         getword(wbuf,sizeof(wbuf),buf,' ');
          strcpy(ExternalCSSFile,buf);
          fixnone(ExternalCSSFile);
          return;
       }
 
       if(strstr(buf,"user_authentication") != 0) {
-         getword(wbuf,buf,' ');
+         getword(wbuf,sizeof(wbuf),buf,' ');
          strcpy(UserAuthentication,buf);
          fixnone(UserAuthentication);
          return;
       }
 
       if(strstr(buf,"AuthUserFile") != 0) {
-         getword(wbuf,buf,' ');
+         getword(wbuf,sizeof(wbuf),buf,' ');
          strcpy(AuthUserFile,buf);
          fixnone(AuthUserFile);
          return;
       }
 
       if(strstr(buf,"AuthName") != 0) {
-         getword(wbuf,buf,' ');
+         getword(wbuf,sizeof(wbuf),buf,' ');
          strcpy(AuthName,buf);
          fixnone(AuthName);
          return;
       }
 
       if(strstr(buf,"AuthType") != 0) {
-         getword(wbuf,buf,' ');
+         getword(wbuf,sizeof(wbuf),buf,' ');
          strcpy(AuthType,buf);
          fixnone(AuthType);
          return;
       }
 
       if(strstr(buf,"Require") != 0) {
-         getword(wbuf,buf,' ');
+         getword(wbuf,sizeof(wbuf),buf,' ');
          strcpy(Require,buf);
          fixnone(Require);
          return;
       }
 
       if(strstr(buf,"download_suffix") != 0) {
-         getword(wbuf,buf,'"');
-         getword(DownloadSuffix,buf,'"');
+         getword(wbuf,sizeof(wbuf),buf,'"');
+         getword(DownloadSuffix,sizeof(DownloadSuffix),buf,'"');
          fixnone(DownloadSuffix);
          return;
       }
 
       if(strstr(buf,"graphs") != 0) {
-         getword(wbuf,buf,' ');
+         getword(wbuf,sizeof(wbuf),buf,' ');
          strcpy(Graphs,buf);
          fixnone(Graphs);
          return;
       }
 
       if(strstr(buf,"graph_days_bytes_bar_color") != 0) {
-         getword(wbuf,buf,' ');
+         getword(wbuf,sizeof(wbuf),buf,' ');
          strcpy(GraphDaysBytesBarColor,buf);
          fixnone(GraphDaysBytesBarColor);
          return;
       }
 
       if(strstr(buf,"squidguard_log_format") != 0) {
-         getword(wbuf,buf,' ');
+         getword(wbuf,sizeof(wbuf),buf,' ');
          strcpy(SquidGuardLogFormat,buf);
          fixnone(SquidGuardLogFormat);
          return;
       }
 
       if(strstr(buf,"squidguard_ignore_date") != 0) {
-         getword(wbuf,buf,' ');
+         getword(wbuf,sizeof(wbuf),buf,' ');
          strcpy(SquidguardIgnoreDate,buf);
          fixnone(SquidguardIgnoreDate);
          return;
       }
 
       if(strstr(buf,"dansguardian_ignore_date") != 0) {
-         getword(wbuf,buf,' ');
+         getword(wbuf,sizeof(wbuf),buf,' ');
          strcpy(DansguardianIgnoreDate,buf);
          fixnone(DansguardianIgnoreDate);
          return;
       }
 
       if(strstr(buf,"ulimit") != 0) {
-         getword(wbuf,buf,' ');
+         getword(wbuf,sizeof(wbuf),buf,' ');
          strcpy(Ulimit,buf);
          fixnone(Ulimit);
          return;
       }
 
       if(strstr(buf,"ntlm_user_format") != 0) {
-         getword(wbuf,buf,' ');
+         getword(wbuf,sizeof(wbuf),buf,' ');
          strcpy(NtlmUserFormat,buf);
          fixnone(NtlmUserFormat);
          return;
       }
 
       if(strstr(buf,"realtime_types") != 0) {
-         getword(wbuf,buf,' ');
+         getword(wbuf,sizeof(wbuf),buf,' ');
          strcpy(RealtimeTypes,buf);
          fixnone(RealtimeTypes);
          return;
       }
 
       if(strstr(buf,"realtime_unauthenticated_records") != 0) {
-         getword(wbuf,buf,' ');
+         getword(wbuf,sizeof(wbuf),buf,' ');
          strcpy(RealtimeUnauthRec,buf);
          fixnone(RealtimeUnauthRec);
          return;
       }
 
       if(strstr(buf,"realtime_refresh_time") != 0) {
-         getword(wbuf,buf,' ');
+         getword(wbuf,sizeof(wbuf),buf,' ');
          realtime_refresh=atoi(buf);
          return;
       }
 
       if(strstr(buf,"realtime_access_log_lines") != 0) {
-         getword(wbuf,buf,' ');
+         getword(wbuf,sizeof(wbuf),buf,' ');
          realtime_access_log_lines=atoi(buf);
          return;
       }
@@ -782,9 +782,9 @@ void parmtest(char *buf)
       }
 
       if(strstr(buf,"byte_cost") != 0) {
-         getword(wbuf,buf,' ');
+         getword(wbuf,sizeof(wbuf),buf,' ');
          cost=atol(buf);
-         getword(wbuf,buf,' ');
+         getword(wbuf,sizeof(wbuf),buf,' ');
          nocost=my_atoll(buf);
          return;
       }
--- sarg-2.2.5/grepday.c.orig	2008-03-03 23:08:01.000000000 +0100
+++ sarg-2.2.5/grepday.c	2008-04-21 17:51:26.000000000 +0200
@@ -419,16 +419,16 @@ void greport_day(char *user, int *iprel,
    } else strcpy(name,user);
 
    while(fgets(buf,sizeof(buf),fp_in)!=NULL) {
-      getword(data,buf,' ');
-      getword(day,data,'/');
+      getword(data,sizeof(data),buf,' ');
+      getword(day,sizeof(day),data,'/');
       if(strcmp(DateFormat,"u") == 0)
-         getword(day,data,'/');
+         getword(day,sizeof(day),data,'/');
       if(!count) {
          strcpy(oday,day);
          count++;
       }
-      getword(bytes,buf,' ');
-      getword(bytes,buf,' ');
+      getword(bytes,sizeof(bytes),buf,' ');
+      getword(bytes,sizeof(bytes),buf,' ');
       bytes[strlen(bytes)-1]='\0';
 
       if(strcmp(oday,day) != 0) {
--- sarg-2.2.5/html.c.orig	2008-03-03 21:39:26.000000000 +0100
+++ sarg-2.2.5/html.c	2008-04-21 17:51:30.000000000 +0200
@@ -78,16 +78,16 @@ void htmlrel()
 
    while(fgets(buf,sizeof(buf),fp_in)!=NULL) {
       if(strstr(buf,"TOTAL") == 0) {
-         getword(wtemp,buf,' ');
+         getword(wtemp,sizeof(wtemp),buf,' ');
          ttnacc+=my_atoll(buf);
-         getword(wtemp,buf,' ');
-         getword(wtemp,buf,' ');
+         getword(wtemp,sizeof(wtemp),buf,' ');
+         getword(wtemp,sizeof(wtemp),buf,' ');
          totbytes+=my_atoll(wtemp);
-         getword(wtemp,buf,' ');
-         getword(wtemp,buf,' ');
-         getword(wtemp,buf,' ');
-         getword(wtemp,buf,' ');
-         getword(wtemp,buf,' ');
+         getword(wtemp,sizeof(wtemp),buf,' ');
+         getword(wtemp,sizeof(wtemp),buf,' ');
+         getword(wtemp,sizeof(wtemp),buf,' ');
+         getword(wtemp,sizeof(wtemp),buf,' ');
+         getword(wtemp,sizeof(wtemp),buf,' ');
          totelap+=my_atoll(wtemp);
       }
    }
@@ -104,7 +104,7 @@ void htmlrel()
       wusuario[0]='\0';
    
       striptxt:
-      getword(warea,usuario,'.');
+      getword(warea,sizeof(warea),usuario,'.');
       strcpy(denied_report,warea);
       strcat(wusuario,warea);
    
@@ -147,17 +147,17 @@ void htmlrel()
       }
    
       while(fgets(buf,sizeof(buf),fp_in)!=NULL) {
-         getword(wtemp,buf,' ');
+         getword(wtemp,sizeof(wtemp),buf,' ');
          tnacc+=my_atoll(wtemp);
-         getword(wtemp,buf,' ');
+         getword(wtemp,sizeof(wtemp),buf,' ');
          tnbytes+=my_atoll(wtemp);
-         getword(wtemp,buf,' ');
-         getword(wtemp,buf,' ');
-         getword(wtemp,buf,' ');
+         getword(wtemp,sizeof(wtemp),buf,' ');
+         getword(wtemp,sizeof(wtemp),buf,' ');
+         getword(wtemp,sizeof(wtemp),buf,' ');
          tnelap+=my_atoll(wtemp);
-         getword(wtemp,buf,' ');
+         getword(wtemp,sizeof(wtemp),buf,' ');
          tnincache+=my_atoll(wtemp);
-         getword(wtemp,buf,' ');
+         getword(wtemp,sizeof(wtemp),buf,' ');
          tnoucache+=my_atoll(wtemp);
       }
 
@@ -337,13 +337,13 @@ void htmlrel()
          sprintf(wwork3,"%s",fixnum2(nnelap,1));
 
          if(strcmp(LongUrl,"yes") != 0) {
-            getword(warea,url,'/');
+            getword(warea,sizeof(warea),url,'/');
             sprintf(url,"%s",warea);
             strcpy(urly,url);
          } else {
             strcpy(urly,url);
             url_module(url, module);
-            getword(warea,url,'/');
+            getword(warea,sizeof(warea),url,'/');
             sprintf(url,"%s...%s",warea,module);
          }
 
--- sarg-2.2.5/index.c.orig	2008-03-03 23:08:01.000000000 +0100
+++ sarg-2.2.5/index.c	2008-04-21 17:51:37.000000000 +0200
@@ -122,7 +122,7 @@ void make_index()
                   bzero(newname,512);
                   strcpy(warea,direntp2->d_name);
                   if(strstr(warea,"-") != 0) {
-                     getword(m1,warea,'-');
+                     getword(m1,sizeof(m1),warea,'-');
                      strcpy(m2,warea);
                      conv_month_name(m1);
                      conv_month_name(m2);
@@ -133,7 +133,7 @@ void make_index()
                   }
                   strcpy(warea,direntp3->d_name);
                   if(strstr(warea,"-") != 0) {
-                     getword(d1,warea,'-');
+                     getword(d1,sizeof(d1),warea,'-');
                      strcpy(d2,warea);
                   } else {
                      strcpy(d1,warea);
@@ -190,15 +190,15 @@ void make_index()
          obtuser(outdir,direntp->d_name,tuser);
          obttotal(outdir,direntp->d_name,tbytes,tuser,media);
          strcpy(html,data);
-         getword(mon,html,' ');
-         getword(mon,html,' ');
-         getword(day,html,' ');
-         getword(hour,html,' ');
-         getword(year,html,' ');
-         getword(year,html,' ');
+         getword(mon,sizeof(mon),html,' ');
+         getword(mon,sizeof(mon),html,' ');
+         getword(day,sizeof(day),html,' ');
+         getword(hour,sizeof(hour),html,' ');
+         getword(year,sizeof(year),html,' ');
+         getword(year,sizeof(year),html,' ');
          strcpy(html,hour);
-         getword(h,html,':');
-         getword(m,html,':');
+         getword(h,sizeof(h),html,':');
+         getword(m,sizeof(m),html,':');
          strcpy(s,html);
          buildymd(day,mon,year,ftime);
          fprintf(fp_tmp,"%s%s%s%s;%s;%s;%s;%s;%s;%s\n",ftime, h, m, s, direntp->d_name, data, tuser, tbytes, media,newname);
@@ -228,7 +228,7 @@ void make_index()
       write_html_header(fp_ou, ".");
       fprintf(fp_ou,"<tr><th %s>%s</th><th %s>%s</th></tr>\n",hbc1,text[130],hbc1,text[132]);
       while(fgets(wwork1,MAXLEN,fp_tmp)!=NULL) {
-         getword(tmp4,wwork1,' ');
+         getword(tmp4,sizeof(tmp4),wwork1,' ');
          fprintf(fp_ou,"<tr><td class=\"data2\"><a href=\"%s\">%s</a></td><td class=\"data2\">%s</td></tr>\n",tmp4,tmp4,wwork1);
          sprintf(tmp2,"%s%s",outdir,tmp4);
          sprintf(tmp3,"%s%s/index.unsort",outdir,tmp4);
@@ -265,7 +265,7 @@ void make_index()
             wwork1[strlen(wwork1)-1]='\0';        
             strcpy(tmp5,wwork1);
             if(strstr(tmp5,"-") != 0) {
-               getword(warea,tmp5,'-');
+               getword(warea,sizeof(warea),tmp5,'-');
                name_month(warea);
                sprintf(tmp6,"%s-",warea);
                name_month(tmp5);
@@ -345,12 +345,12 @@ void make_index()
          exit(1);
       }
       while(fgets(buf,MAXLEN,fp_tmp2)!=NULL) {
-         getword(period,buf,';');
-         getword(period,buf,';');
-         getword(data,buf,';');
-         getword(tuser,buf,';');
-         getword(tbytes,buf,';');
-         getword(media,buf,';');
+         getword(period,sizeof(period),buf,';');
+         getword(period,sizeof(period),buf,';');
+         getword(data,sizeof(data),buf,';');
+         getword(tuser,sizeof(tuser),buf,';');
+         getword(tbytes,sizeof(tbytes),buf,';');
+         getword(media,sizeof(media),buf,';');
          fprintf(fp_ou,"<tr><td class=\"data2\"><a href='%s/%s'>%s</a></td><td class=\"data2\">%s</td><td class=\"data\">%s</td><td class=\"data\">%s</td><td class=\"data\">%s</td></tr>\n",period,ReplaceIndex,period,data,tuser,tbytes,media);
       }
       if(fp_tmp2) fclose(fp_tmp2);
--- sarg-2.2.5/ip2name.c.orig	2008-03-03 23:08:01.000000000 +0100
+++ sarg-2.2.5/ip2name.c	2008-04-21 17:51:40.000000000 +0200
@@ -59,7 +59,7 @@ void name2ip(char *name)
    char   n4[4];
 
    if(strstr(name,":") > 0) {
-      getword(work,name,':');
+      getword(work,sizeof(work),name,':');
       strcpy(name,work);
    }
 
@@ -69,9 +69,9 @@ void name2ip(char *name)
       memcpy(&ia.s_addr,hp->h_addr_list[0],sizeof(ia.s_addr));
       ia.s_addr=ntohl(ia.s_addr);
       sprintf(name,"%s",inet_ntoa(ia));
-      getword(n4,name,'.');
-      getword(n3,name,'.');
-      getword(n2,name,'.');
+      getword(n4,sizeof(n4),name,'.');
+      getword(n3,sizeof(n3),name,'.');
+      getword(n2,sizeof(n2),name,'.');
       strcpy(n1,name);
       sprintf(name,"%s.%s.%s.%s",n1,n2,n3,n4);
 
--- sarg-2.2.5/language.c.orig	2008-03-03 23:08:01.000000000 +0100
+++ sarg-2.2.5/language.c	2008-04-21 17:52:00.000000000 +0200
@@ -1,55 +1,55 @@
-/*
- * AUTHOR: Pedro Lineu Orso                         pedro.orso@gmail.com
- *                                                            1998, 2008
- * SARG Squid Analysis Report Generator      http://sarg.sourceforge.net
- *
- * SARG donations:
- *      please look at http://sarg.sourceforge.net/donations.php
- * ---------------------------------------------------------------------
- *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
- *  (at your option) any later version.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA.
- *
- */
-
-#include "include/conf.h"
-
-void language_load(char *language)
-{
-
-   FILE *fp_text;
-   int record=0;
-
-   sprintf(warea,"%s/languages/%s",SYSCONFDIR,language);
-
-   if((fp_text=fopen(warea,"r"))==NULL) {
-     fprintf(stderr, "SARG: (language) Cannot open language file: %s\n",warea);
-     exit(1);
-   }
-
-   while(fgets(buf,MAXLEN,fp_text)!=NULL) {
-      getword(warea,buf,'"');
-      getword(warea,buf,'"');
-      strcpy(text[record],warea);
-
-      if(langcode)
-      printf("%d %s\n",record,warea);
-
-      record++;
-   }
-
-   fclose(fp_text);
-
-   return;
-}
+/*
+ * AUTHOR: Pedro Lineu Orso                         pedro.orso@gmail.com
+ *                                                            1998, 2008
+ * SARG Squid Analysis Report Generator      http://sarg.sourceforge.net
+ *
+ * SARG donations:
+ *      please look at http://sarg.sourceforge.net/donations.php
+ * ---------------------------------------------------------------------
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA.
+ *
+ */
+
+#include "include/conf.h"
+
+void language_load(char *language)
+{
+
+   FILE *fp_text;
+   int record=0;
+
+   sprintf(warea,"%s/languages/%s",SYSCONFDIR,language);
+
+   if((fp_text=fopen(warea,"r"))==NULL) {
+     fprintf(stderr, "SARG: (language) Cannot open language file: %s\n",warea);
+     exit(1);
+   }
+
+   while(fgets(buf,MAXLEN,fp_text)!=NULL) {
+      getword(warea,sizeof(warea),buf,'"');
+      getword(warea,sizeof(warea),buf,'"');
+      strcpy(text[record],warea);
+
+      if(langcode)
+      printf("%d %s\n",record,warea);
+
+      record++;
+   }
+
+   fclose(fp_text);
+
+   return;
+}
--- sarg-2.2.5/lastlog.c.orig	2008-03-03 23:08:01.000000000 +0100
+++ sarg-2.2.5/lastlog.c	2008-04-21 17:52:05.000000000 +0200
@@ -88,7 +88,7 @@ void mklastlog()
    }
 
    while(fgets(buf,sizeof(buf),fp_in)!=NULL) {
-      getword(warea,buf,' ');
+      getword(warea,sizeof(warea),buf,' ');
       buf[strlen(buf)-1]='\0';
      
       if(ftot) {
--- sarg-2.2.5/log.c.orig	2008-04-21 17:05:25.000000000 +0200
+++ sarg-2.2.5/log.c	2008-04-21 17:52:18.000000000 +0200
@@ -300,7 +300,7 @@ int main(argc,argv)
          case 'd':
             strcpy(date,optarg);
             strcpy(cduntil,optarg);
-            getword(cdfrom,cduntil,'-');
+            getword(cdfrom,sizeof(cdfrom),cduntil,'-');
             date_from(date, cdfrom, cduntil);
             dfrom=atoi(cdfrom);
             duntil=atoi(cduntil);
@@ -351,7 +351,7 @@ int main(argc,argv)
               strcpy(hm,optarg);
               strcpy(hmf,optarg);
             } else {
-               getword(hm,optarg,'-');
+               getword(hm,sizeof(hm),optarg,'-');
                strcpy(hmf,optarg);
             }
             if(strlen(hm) > 5) {
@@ -360,13 +360,13 @@ int main(argc,argv)
             }
             bzero(whm,15);
             if(strstr(hm,":") != 0) {
-               getword(warea,hm,':');
+               getword(warea,sizeof(warea),hm,':');
                sprintf(whm,"%s%s",warea,hm);
                strcpy(hm,whm);
             }
             bzero(whm,15);
             if(strstr(hmf,":") != 0) {
-               getword(warea,hmf,':');
+               getword(warea,sizeof(warea),hmf,':');
                sprintf(whm,"%s%s",warea,hmf);
                strcpy(hmf,whm);
             }
@@ -692,7 +692,7 @@ int main(argc,argv)
       while(fgets(buf,MAXLEN,fp_usr)!=NULL) {
          buf[strlen(buf)-1]='\0';
          if(strstr(buf,"\r") != 0) buf[strlen(buf)-1]='\0';
-         getword(bufy,buf,' ');
+         getword(bufy,sizeof(bufy),buf,' ');
          for(z1=0; z1<=strlen(bufy); z1++) {
             userfile[z2]=bufy[z1];
             z2++;
@@ -733,10 +733,10 @@ int main(argc,argv)
    if(!isalog && strncmp(bufz,"#Software: Mic",14) == 0) isalog++;
 
    if(strncmp(bufz,"*** SARG Log ***",16) == 0) {
-      getword(val2,arqtt,'-');
-      getword(val2,arqtt,'_');
-      getword(val3,arqtt,'-');
-      getword(val3,arqtt,'_');
+      getword(val2,sizeof(val2),arqtt,'-');
+      getword(val2,sizeof(val2),arqtt,'_');
+      getword(val3,sizeof(val3),arqtt,'-');
+      getword(val3,sizeof(val3),arqtt,'_');
       sprintf(period,"%s-%s",val2,val3);
       sarglog=1;
    } else lseek(fileno(fp_in), 0, 0);
@@ -816,7 +816,7 @@ int main(argc,argv)
            strcpy(warea,bufz);
            strcpy(html,ExcludeString);
            while(strstr(html,":") != 0) {
-              getword(val1,html,':');
+              getword(val1,sizeof(val1),html,':');
               if((str=(char *) strstr(warea,val1)) != (char *) NULL )
                  exstring++;
            }
@@ -835,29 +835,29 @@ int main(argc,argv)
        	   printf("BUF=%s\n",bufz);
 
         if(!sarglog && !isalog) {
-           getword(data,bufz,' ');
+           getword(data,sizeof(data),bufz,' ');
            if((str=(char *) strstr(data, ".")) != (char *) NULL ) {
               if((str=(char *) strstr(str+1, ".")) != (char *) NULL ) {
                  strcpy(ip,data);
        	         strcpy(elap,"0");
 		 if(squid24) {
-                    getword(user,bufz,' ');
-                    getword(none,bufz,' ');
+                    getword(user,sizeof(user),bufz,' ');
+                    getword(none,sizeof(none),bufz,' ');
 		 } else {
-	            getword(none,bufz,' ');
-   	            getword(user,bufz,' ');
+	            getword(none,sizeof(none),bufz,' ');
+   	            getword(user,sizeof(user),bufz,' ');
 		 }
-	         getword(data,bufz,']');
-	         getword(fun,bufz,'"');
-	         getword(fun,bufz,' ');
-	         getword(url,bufz,' ');
-                 getword(code2,bufz,' ');
-                 getword(code2,bufz,' ');
-                 getword(tam,bufz,' ');
+	         getword(data,sizeof(data),bufz,']');
+	         getword(fun,sizeof(fun),bufz,'"');
+	         getword(fun,sizeof(fun),bufz,' ');
+	         getword(url,sizeof(url),bufz,' ');
+                 getword(code2,sizeof(code2),bufz,' ');
+                 getword(code2,sizeof(code2),bufz,' ');
+                 getword(tam,sizeof(tam),bufz,' ');
 
 
                  if((str=(char *) strstr(bufz, " ")) != (char *) NULL )
-                    getword(code,bufz,' ');
+                    getword(code,sizeof(code),bufz,' ');
                  else strcpy(code,bufz);
 
                  if ((str = strchr(code, ':')) != NULL)
@@ -872,37 +872,37 @@ int main(argc,argv)
 	   }
 
 	   if(!common) {
-	      getword(elap,bufz,' ');
+	      getword(elap,sizeof(elap),bufz,' ');
 	      while(strcmp(elap,"") == 0 && strlen(bufz) > 0)
-	         getword(elap,bufz,' ');
+	         getword(elap,sizeof(elap),bufz,' ');
               if(strlen(elap) < 1) continue;
-	      getword(ip,bufz,' ');
-	      getword(code,bufz,' ');
-	      getword(tam,bufz,' ');
-	      getword(fun,bufz,' ');
-	      getword(url,bufz,' ');
+	      getword(ip,sizeof(ip),bufz,' ');
+	      getword(code,sizeof(code),bufz,' ');
+	      getword(tam,sizeof(tam),bufz,' ');
+	      getword(fun,sizeof(fun),bufz,' ');
+	      getword(url,sizeof(url),bufz,' ');
 //              while (strstr(bufz,"%20") != 0) {
-//                 getword(warea,bufz,' ');
+//                 getword(warea,sizeof(warea),bufz,' ');
 //                 strcat(url,warea);
 //              }
-	      getword(user,bufz,' ');
+	      getword(user,sizeof(user),bufz,' ');
 	      squid_log=1;
 	   }
         } else if(!isalog) {
-	   getword(data,bufz,' ');
-	   getword(hora,bufz,' ');
-	   getword(user,bufz,' ');
-	   getword(ip,bufz,' ');
-	   getword(url,bufz,' ');
-	   getword(tam,bufz,' ');
-	   getword(code,bufz,' ');
-	   getword(elap,bufz,' ');
-	   getword(smartfilter,bufz,' ');
+	   getword(data,sizeof(data),bufz,' ');
+	   getword(hora,sizeof(hora),bufz,' ');
+	   getword(user,sizeof(user),bufz,' ');
+	   getword(ip,sizeof(ip),bufz,' ');
+	   getword(url,sizeof(url),bufz,' ');
+	   getword(tam,sizeof(tam),bufz,' ');
+	   getword(code,sizeof(code),bufz,' ');
+	   getword(elap,sizeof(elap),bufz,' ');
+	   getword(smartfilter,sizeof(smartfilter),bufz,' ');
         } else if(isalog) {
            if(!i0) {
-              getword(val1,bufz,' ');
+              getword(val1,sizeof(val1),bufz,' ');
               while(strstr(bufz,"\t") != 0) {
-                 getword(val1,bufz,'\t');
+                 getword(val1,sizeof(val1),bufz,'\t');
                  i0++;
                  if(strcmp(val1,"c-ip") == 0) i1=i0;
                  if(strcmp(val1,"cs-username") == 0) i2=i0;
@@ -936,8 +936,8 @@ int main(argc,argv)
               sprintf(val1,"DENIED/%s",code);
               strcpy(code,val1);
            }
-           getword(ano,data,'-');
-           getword(mes,data,'-');
+           getword(ano,sizeof(ano),data,'-');
+           getword(mes,sizeof(mes),data,'-');
            strcpy(dia,data);
            conv_month_name(mes);
            sprintf(data," %s/%s/%s:%s",dia,mes,ano,hora);
@@ -966,12 +966,12 @@ int main(argc,argv)
 	   continue;
 
         if(strstr(user,"%20") != 0) {
-           getword(w,user,'%');
+           getword(w,sizeof(w),user,'%');
            strcpy(user,w);
         }
 
         while(strstr(user,"%5c") != 0) {
-           getword(w,user,'%');
+           getword(w,sizeof(w),user,'%');
            strcpy(wuser,user+2);
            sprintf(user,"%s.%s",w,wuser);
         }
@@ -988,9 +988,9 @@ int main(argc,argv)
         strlow(user);
         if(strncmp(NtlmUserFormat,"user",4) == 0) {
            if(strstr(user,"_") != 0)
-              getword(warea,user,'_');  
+              getword(warea,sizeof(warea),user,'_');  
            if(strstr(user,"+") != 0)
-              getword(warea,user,'+');  
+              getword(warea,sizeof(warea),user,'+');  
         }
 
         if(strstr(ReportType,"denied") != 0)
@@ -1010,8 +1010,8 @@ int main(argc,argv)
         }
          
         if (strchr(url,'/')) {
-           getword(w,url,'/');
-           getword(w,url,'/');
+           getword(w,sizeof(w),url,'/');
+           getword(w,sizeof(w),url,'/');
           if (!strchr(url,'/')) {
               totregsx++;
               continue;
@@ -1019,10 +1019,10 @@ int main(argc,argv)
         }
 
         if(strcmp(LongUrl,"no") == 0) {
-           getword(w,url,'/');
+           getword(w,sizeof(w),url,'/');
            strcpy(url,w);
            if(strlen(url) > 512 && strstr(url,"%") != 0) {
-              getword(w,url,'%');
+              getword(w,sizeof(w),url,'%');
               strcpy(url,w);
            }
         }
@@ -1052,11 +1052,11 @@ int main(argc,argv)
               sprintf(hora,"%02d:%02d:%02d",t->tm_hour,t->tm_min,t->tm_sec);
 	    } else {
 	      strcpy(wtemp,data+1);
-	      getword(data,wtemp,':');
-	      getword(hora,wtemp,' ');
-	      getword(dia,data,'/');
-	      getword(mes,data,'/');
-	      getword(ano,data,'/');
+	      getword(data,sizeof(data),wtemp,':');
+	      getword(hora,sizeof(hora),wtemp,' ');
+	      getword(dia,sizeof(dia),data,'/');
+	      getword(mes,sizeof(mes),data,'/');
+	      getword(ano,sizeof(ano),data,'/');
 
               if(strcmp(df,"u") == 0)
 	         sprintf(tbuf,"%s%s%s",ano,mes,dia);
@@ -1066,8 +1066,8 @@ int main(argc,argv)
               idata=atoi(wdata);
 	   }
         } else {
-	   getword(mes,data,'/');
-	   getword(dia,data,'/');
+	   getword(mes,sizeof(mes),data,'/');
+	   getword(dia,sizeof(dia),data,'/');
 	   strcpy(ano,data);
         }
 
@@ -1105,7 +1105,7 @@ int main(argc,argv)
               bzero(hmr,15);
               chm++;
               while(chm) {
-                 getword(warea,whm,':');
+                 getword(warea,sizeof(warea),whm,':');
                  strncat(hmr,warea,2);
                  chm--;
               }
@@ -1370,8 +1370,8 @@ int main(argc,argv)
    if(strcmp(ParsedOutputLog, "no") != 0 && !sarglog) {
       fclose(fp_log); 
       strcpy(val1,period);
-      getword(val2,val1,'-');
-      getword(val3,per_hour,'-');
+      getword(val2,sizeof(val2),val1,'-');
+      getword(val3,sizeof(val3),per_hour,'-');
       sprintf(val4,"%s/sarg-%s_%s-%s_%s.log",ParsedOutputLog,val2,val3,val1,per_hour);
       rename(arq_log,val4);
       strcpy(arq_log,val4);
@@ -1463,7 +1463,7 @@ void getusers(char *pwdfile, int debug)
    sprintf(userfile,":");
 
    while(fgets(buf,255,fp_usr)!=NULL) {
-     getword(user,buf,':');
+     getword(user,sizeof(user),buf,':');
      strncat(userfile,user,strlen(user));
      strncat(userfile,":",1);
    }
--- sarg-2.2.5/realtime.c.orig	2008-03-03 21:39:26.000000000 +0100
+++ sarg-2.2.5/realtime.c	2008-04-21 17:52:22.000000000 +0200
@@ -75,7 +75,7 @@ void getlog()
       while(fgets(buf,MAXLEN,fp_usr)!=NULL){
         buf[strlen(buf)-1]='\0';
         if(strstr(buf,"\r") != 0) buf[strlen(buf)-1]='\0';
-        getword(bufy,buf,' ');
+        getword(bufy,sizeof(bufy),buf,' ');
         for(z1=0; z1<=strlen(bufy); z1++) {
            userfile[z2]=bufy[z1];
            z2++;
--- sarg-2.2.5/repday.c.orig	2008-03-03 23:08:01.000000000 +0100
+++ sarg-2.2.5/repday.c	2008-04-21 17:52:32.000000000 +0200
@@ -140,14 +140,14 @@ void report_day(char *user, int *iprel, 
      "<td class=\"header3\">%s<br>%s</td></tr>\n", text[107], html );
 
    while(fgets(buf,sizeof(buf),fp_in)!=NULL) {
-      getword(data,buf,' ');
+      getword(data,sizeof(data),buf,' ');
       if(!count) {
          strcpy(odata,data);
          count++;
       }
 
-      getword(hour,buf,' ');
-      getword(elap,buf,' ');
+      getword(hour,sizeof(hour),buf,' ');
+      getword(elap,sizeof(elap),buf,' ');
       elap[strlen(elap)-1]='\0';
 
       if(strcmp(data,odata) != 0) {
--- sarg-2.2.5/report.c.orig	2008-03-03 23:08:01.000000000 +0100
+++ sarg-2.2.5/report.c	2008-04-21 17:52:42.000000000 +0200
@@ -86,7 +86,7 @@ void gerarel()
     
       strcpy(wdname,direntp->d_name);
       strip_prefix:
-      getword(wname2,wdname,'.');
+      getword(wname2,sizeof(wname2),wdname,'.');
       strcat(user,wname2);
    
       if(strcmp(wdname,"log") !=0) {
@@ -102,17 +102,17 @@ void gerarel()
       bzero(html_old, MAXLEN);
    
       while(fgets(buf,sizeof(buf),fp_in)!=NULL) {
-         getword(accdia,buf,' ');
-         getword(acchora,buf,' ');
-         getword(accuser,buf,' ');
-         getword(accip,buf,' ');
-         getword(accurl,buf,' ');
-         getword(accbytes,buf,' ');
-         getword(acccode,buf,' ');
+         getword(accdia,sizeof(accdia),buf,' ');
+         getword(acchora,sizeof(acchora),buf,' ');
+         getword(accuser,sizeof(accuser),buf,' ');
+         getword(accip,sizeof(accip),buf,' ');
+         getword(accurl,sizeof(accurl),buf,' ');
+         getword(accbytes,sizeof(accbytes),buf,' ');
+         getword(acccode,sizeof(acccode),buf,' ');
          if(strncmp(acccode,"TCP_DENIED/407",14) == 0) continue;
-         getword(accelap,buf,' ');
-         getword(accsmart,buf,' ');
-         getword(accsmart,buf,'"');
+         getword(accelap,sizeof(accelap),buf,' ');
+         getword(accsmart,sizeof(accsmart),buf,' ');
+         getword(accsmart,sizeof(accsmart),buf,'"');
    
          if(strlen(accsmart) > 0) {
             smartfilter++;
@@ -276,7 +276,7 @@ void gerarel()
       } else bzero(ltext110, 50);
 
       strcpy(wcrc,acccode);
-      getword(crc2,wcrc,'/');
+      getword(crc2,sizeof(crc2),wcrc,'/');
 
       if(strstr(crc2,"MISS") != 0)
          oucache+=my_atoll(accbytes);
--- sarg-2.2.5/siteuser.c.orig	2008-03-03 23:08:01.000000000 +0100
+++ sarg-2.2.5/siteuser.c	2008-04-21 17:52:46.000000000 +0200
@@ -121,7 +121,7 @@ void siteuser()
    strcat(users," ");
 
    while(fgets(buf,sizeof(buf),fp_in)!=NULL) {
-      getword(user,buf,' ');
+      getword(user,sizeof(user),buf,' ');
       if(strcmp(user,"TOTAL") == 0)
          continue;
       if(userip)
@@ -152,10 +152,10 @@ void siteuser()
       if(strcmp(Ip2Name,"yes") == 0)
          ip2name(user);
 
-      getword(nacc,buf,' ');
+      getword(nacc,sizeof(nacc),buf,' ');
       if (atoi(nacc) > 0) nsitesusers = 1;
-      getword(nbytes,buf,' ');
-      getword(url,buf,' ');
+      getword(nbytes,sizeof(nbytes),buf,' ');
+      getword(url,sizeof(url),buf,' ');
 
       if(!regs) {
          strcpy(ourl,url);
--- sarg-2.2.5/smartfilter.c.orig	2008-03-03 23:08:01.000000000 +0100
+++ sarg-2.2.5/smartfilter.c	2008-04-21 17:52:50.000000000 +0200
@@ -104,12 +104,12 @@ void smartfilter_report()
    fprintf(fp_ou,"<tr><th bgcolor=%s><font size=%s>%s</font></th><th bgcolor=%s><font size=%s>%s</font></th><th bgcolor=%s><font size=%s>%s</font></th><th bgcolor=%s><font size=%s>%s</font></th><th bgcolor=%s><font size=%s>%s</font></th></tr>\n",HeaderBgColor,FontSize,text[98],HeaderBgColor,FontSize,text[111],HeaderBgColor,FontSize,text[110],HeaderBgColor,FontSize,text[91],HeaderBgColor,FontSize,smartheader);
 
    while(fgets(buf,sizeof(buf),fp_in)!=NULL) {
-      getword(user,buf,' ');
-      getword(data,buf,' ');
-      getword(hora,buf,' ');
-      getword(ip,buf,' ');
-      getword(url,buf,' ');
-      getword(smartcat,buf,'\n');
+      getword(user,sizeof(user),buf,' ');
+      getword(data,sizeof(data),buf,' ');
+      getword(hora,sizeof(hora),buf,' ');
+      getword(ip,sizeof(ip),buf,' ');
+      getword(url,sizeof(url),buf,' ');
+      getword(smartcat,sizeof(smartcat),buf,'\n');
 
       if((str=(char *) strstr(user, "_")) != (char *) NULL ) {
          if((str=(char *) strstr(str+1, "_")) != (char *) NULL )
--- sarg-2.2.5/sort.c.orig	2008-03-03 23:08:01.000000000 +0100
+++ sarg-2.2.5/sort.c	2008-04-21 17:52:59.000000000 +0200
@@ -53,7 +53,7 @@ void tmpsort()
  
       wnome[0]='\0'; 
       striptmp:
-      getword(wnome2,wentp,'.');
+      getword(wnome2,sizeof(wnome2),wentp,'.');
       strcat(wnome,wnome2);
 
       if(strcmp(wentp,"utmp") !=0) {
@@ -136,7 +136,7 @@ void sort_users_log(char *tmp, int debug
 
       bzero(user, MAXLEN);
       strip_unsort:
-      getword(wname2,wdname,'.');
+      getword(wname2,sizeof(wname2),wdname,'.');
       strcat(user,wname2);
 
       if(strcmp(wdname,"unsort") !=0) {
--- sarg-2.2.5/splitlog.c.orig	2008-04-21 17:05:25.000000000 +0200
+++ sarg-2.2.5/splitlog.c	2008-04-21 17:53:14.000000000 +0200
@@ -47,7 +47,7 @@ void splitlog(char *arq, char *df, int d
    }
 
    while(fgets(buf,sizeof(buf),fp_in)!=NULL) {
-      getword(data,buf,' ');
+      getword(data,sizeof(data),buf,' ');
       tt=atoi(data);
       t=localtime(&tt);
 
--- sarg-2.2.5/squidguard_log.c.orig	2008-03-03 23:08:01.000000000 +0100
+++ sarg-2.2.5/squidguard_log.c	2008-04-21 17:53:22.000000000 +0200
@@ -42,8 +42,8 @@ void read_log(char *wentp, FILE *fp_ou)
 
    if(debug) {
       strcpy(buf,text[7]);
-      getword(urly,buf,' ');
-      getword(href,buf,' ');
+      getword(urly,sizeof(urly),buf,' ');
+      getword(href,sizeof(href),buf,' ');
       sprintf(msg,"%s squidGuard %s: %s",urly,buf,wentp);
       debuga(msg);
    }
@@ -95,12 +95,12 @@ void read_log(char *wentp, FILE *fp_ou)
       if(strlen(SquidGuardLogFormat) > 0) {
          strcpy(bufbsf,SquidGuardLogFormat);
          leks[0]='\0';
-         getword(leks,bufbsf,'#');
+         getword(leks,sizeof(leks),bufbsf,'#');
          while(strcmp(leks,"end") != 0) {
-            getword(leks,bufbsf,'#');
-            getword(sep,bufbsf,'#');
+            getword(leks,sizeof(leks),bufbsf,'#');
+            getword(sep,sizeof(sep),bufbsf,'#');
             if(strcmp(leks,"end") != 0) {
-               getword(res,buf,sep[0]);
+               getword(res,sizeof(res),buf,sep[0]);
                if(strcmp(leks,"year") == 0)
                   strcpy(year,res);
                else if(strcmp(leks,"year") == 0)
@@ -122,19 +122,19 @@ void read_log(char *wentp, FILE *fp_ou)
             }
          }
       } else {
-         getword(year,buf,'-');
-         getword(mon,buf,'-');
-         getword(day,buf,' ');
-         getword(hour,buf,' ');
-         getword(list,buf,'/');
-         getword(list,buf,'/');
-         getword(tmp5,buf,'/');
-         getword(tmp5,buf,'/');
-         getword(url,buf,'/');
-         getword(ip,buf,' ');
-         getword(ip,buf,'/');
-         getword(user,buf,' ');
-         getword(user,buf,' ');
+         getword(year,sizeof(year),buf,'-');
+         getword(mon,sizeof(mon),buf,'-');
+         getword(day,sizeof(day),buf,' ');
+         getword(hour,sizeof(hour),buf,' ');
+         getword(list,sizeof(list),buf,'/');
+         getword(list,sizeof(list),buf,'/');
+         getword(tmp5,sizeof(tmp5),buf,'/');
+         getword(tmp5,sizeof(tmp5),buf,'/');
+         getword(url,sizeof(url),buf,'/');
+         getword(ip,sizeof(ip),buf,' ');
+         getword(ip,sizeof(ip),buf,'/');
+         getword(user,sizeof(user),buf,' ');
+         getword(user,sizeof(user),buf,' ');
       }
 
       sprintf(warea,"%s%s%s",year,mon,day);
@@ -236,8 +236,8 @@ int squidguard_log()
          if(strstr(buf,"\n") != 0)
             buf[strlen(buf)-1]='\0';
          if(strstr(buf,"logdir ") != 0) {
-            getword(logdir,buf,' ');
-            getword(logdir,buf,' ');
+            getword(logdir,sizeof(logdir),buf,' ');
+            getword(logdir,sizeof(logdir),buf,' ');
          }
          if((str=(char *) strstr(buf, "log")) != (char *) NULL )  {
             str=str+3;
@@ -255,11 +255,11 @@ int squidguard_log()
                }
             }
             if(strchr(str2,' ') != 0) {
-               getword(warea,str2,' ');
+               getword(warea,sizeof(warea),str2,' ');
                strcpy(str2,warea);
             }
             if(strchr(str2,'#') != 0) {
-               getword(warea,str2,'#');
+               getword(warea,sizeof(warea),str2,'#');
                strcpy(str2,warea);
             }
             sprintf(wentp,"%s/%s",logdir,str2);
--- sarg-2.2.5/squidguard_report.c.orig	2008-03-03 23:08:01.000000000 +0100
+++ sarg-2.2.5/squidguard_report.c	2008-04-21 17:53:26.000000000 +0200
@@ -107,12 +107,12 @@ void squidguard_report()
    fputs(url,fp_ou);
 
    while(fgets(buf,sizeof(buf),fp_in)!=NULL) {
-      getword(user,buf,' ');
-      getword(data2,buf,' ');
-      getword(hora,buf,' ');
-      getword(ip,buf,' ');
-      getword(url,buf,' ');
-      getword(rule,buf,'\n');
+      getword(user,sizeof(user),buf,' ');
+      getword(data2,sizeof(data2),buf,' ');
+      getword(hora,sizeof(hora),buf,' ');
+      getword(ip,sizeof(ip),buf,' ');
+      getword(url,sizeof(url),buf,' ');
+      getword(rule,sizeof(rule),buf,'\n');
 
       if(strcmp(UserIp,"yes") == 0)
            strcpy(user,ip);
--- sarg-2.2.5/topsites.c.orig	2008-03-03 23:08:01.000000000 +0100
+++ sarg-2.2.5/topsites.c	2008-04-21 17:53:29.000000000 +0200
@@ -91,20 +91,20 @@ void topsites()
    }
 
    while(fgets(buf,sizeof(buf),fp_in)!=NULL) {
-      getword(url,buf,' ');
+      getword(url,sizeof(url),buf,' ');
       if(strcmp(url,"TOTAL") == 0) {
-         getword(ttnacc,buf,' ');
-         getword(ttnbytes,buf,' ');
-         getword(ttntime,buf,' ');
+         getword(ttnacc,sizeof(ttnacc),buf,' ');
+         getword(ttnbytes,sizeof(ttnbytes),buf,' ');
+         getword(ttntime,sizeof(ttntime),buf,' ');
          continue;
       }
-      getword(nacc,buf,' ');
-      getword(nbytes,buf,' ');
-      getword(url,buf,' ');
-      getword(ntemp,buf,' ');
-      getword(ntemp,buf,' ');
-      getword(ntemp,buf,' ');
-      getword(ntime,buf,' ');
+      getword(nacc,sizeof(nacc),buf,' ');
+      getword(nbytes,sizeof(nbytes),buf,' ');
+      getword(url,sizeof(url),buf,' ');
+      getword(ntemp,sizeof(ntemp),buf,' ');
+      getword(ntemp,sizeof(ntemp),buf,' ');
+      getword(ntemp,sizeof(ntemp),buf,' ');
+      getword(ntime,sizeof(ntime),buf,' ');
 
       if(!regs) {
          strcpy(ourl,url);
@@ -203,12 +203,12 @@ void topsites()
    while(fgets(buf,sizeof(buf),fp_in)!=NULL) {
       if(regs>atoi(TopSitesNum))
          break;
-      getword(nacc,buf,' ');
+      getword(nacc,sizeof(nacc),buf,' ');
       if (atoi(nacc) == 0) continue;
 
-      getword(nbytes,buf,' ');
-      getword(ntime,buf,' ');
-      getword(url,buf,' ');
+      getword(nbytes,sizeof(nbytes),buf,' ');
+      getword(ntime,sizeof(ntime),buf,' ');
+      getword(url,sizeof(url),buf,' ');
 
       twork1=my_atoll(nacc);
       twork2=my_atoll(nbytes);
--- sarg-2.2.5/totday.c.orig	2008-03-03 23:08:01.000000000 +0100
+++ sarg-2.2.5/totday.c	2008-04-21 17:53:33.000000000 +0200
@@ -73,10 +73,10 @@ void day_totalize(const char *tmp, char 
       if(strstr(buf,"\n") != 0)
          buf[strlen(buf)-1]='\0';
          
-      getword(data,buf,' ');
-      getword(hora,buf,':');
-      getword(min,buf,':');
-      getword(elap,buf,' ');
+      getword(data,sizeof(data),buf,' ');
+      getword(hora,sizeof(hora),buf,':');
+      getword(min,sizeof(min),buf,':');
+      getword(elap,sizeof(elap),buf,' ');
       strcpy(elap,buf);
       sprintf(hm,"%s%s",hora,min);
 
--- sarg-2.2.5/useragent.c.orig	2008-03-03 23:08:01.000000000 +0100
+++ sarg-2.2.5/useragent.c	2008-04-21 17:53:39.000000000 +0200
@@ -70,13 +70,13 @@ void useragent()
 
    while(fgets(buf,sizeof(buf),fp_in)!=NULL) {
       totregsl++;
-      getword(ip,buf,' ');
-      getword(data,buf,'[');
-      getword(data,buf,' ');
+      getword(ip,sizeof(ip),buf,' ');
+      getword(data,sizeof(data),buf,'[');
+      getword(data,sizeof(data),buf,' ');
       if(totregsl == 1)
          strcpy(idate,data);
-      getword(agent,buf,'"');
-      getword(agent,buf,'"');
+      getword(agent,sizeof(agent),buf,'"');
+      getword(agent,sizeof(agent),buf,'"');
 
       strcpy(warea,agent);
       strup(warea);
@@ -84,8 +84,8 @@ void useragent()
          baddata();
 
       if(strlen(buf)) {
-         getword(user,buf,' ');
-         getword(user,buf,'\n');
+         getword(user,sizeof(user),buf,' ');
+         getword(user,sizeof(user),buf,'\n');
       }
 
       if(user[0] == '-')
@@ -165,7 +165,7 @@ void useragent()
    fputs(html,fp_ou);
 
    while(fgets(buf,sizeof(buf),fp_in)!=NULL) {
-      getword(ip,buf,'\\');
+      getword(ip,sizeof(ip),buf,'\\');
 
       if(strcmp(Ip2Name,"yes") == 0) {
          if(strcmp(ip,ipbefore) != 0) {
@@ -175,9 +175,9 @@ void useragent()
          } else strcpy(ip,namebefore);
       }
 
-      getword(data,buf,'\\');
-      getword(agent,buf,'\\');
-      getword(user,buf,'\\');
+      getword(data,sizeof(data),buf,'\\');
+      getword(agent,sizeof(agent),buf,'\\');
+      getword(user,sizeof(user),buf,'\\');
 
       if(strcmp(user,user_old) != 0) {
          sprintf(html,"<tr><td align=left bgcolor=%s><font size=%s>%s</td><td align=left bgcolor=%s><font size=%s>%s</td></tr>\n",TxBgColor,FontSize,user,TxBgColor,FontSize,agent);
@@ -215,9 +215,9 @@ void useragent()
    agent_old[0]='\0';
 
    while(fgets(buf,sizeof(buf),fp_in)!=NULL) {
-      getword(ip,buf,'\\');
-      getword(data,buf,'\\');
-      getword(agent,buf,'\\');
+      getword(ip,sizeof(ip),buf,'\\');
+      getword(data,sizeof(data),buf,'\\');
+      getword(agent,sizeof(agent),buf,'\\');
 
       if(!cont) {
          cont++;
@@ -268,7 +268,7 @@ void useragent()
 
    while(fgets(buf,sizeof(buf),fp_in)!=NULL) {
       buf[strlen(buf)-1]='\0';
-      getword(tagent,buf,' ');
+      getword(tagent,sizeof(tagent),buf,' ');
       perc=atoi(tagent) * 100;
       perc=perc / agentot2;
 
--- sarg-2.2.5/util.c.orig	2008-03-03 23:08:01.000000000 +0100
+++ sarg-2.2.5/util.c	2008-04-21 17:53:52.000000000 +0200
@@ -53,10 +53,9 @@ static char mtab2[12][3]={"01","02","03"
     }
 }*/
 
-void getword(char *word, char *line, int stop)
+void getword(char *word, int limit, char *line, int stop)
 {
   int x = 0, y = 0;
-  int limit=10000;
   char wline[MAXLEN];
 
   //strcpy(wline,line);
@@ -83,10 +82,9 @@ void getword(char *word, char *line, int
   while((line[y++] = line[x++]));
 }
 
-char *  getword2(char *word, char *line, int stop)
+char *  getword2(char *word, int limit, char *line, int stop)
 {
   int x = 0;
-  int limit=MAXLEN;
 
   if(strlen(line) < 3) {
      word[0]='\0';
@@ -194,9 +192,9 @@ void my_mkdir(char *name)
 
    strcpy(w0,name);
    strcpy(w2,"/");
-   getword(w1,w0,'/');
+   getword(w1,sizeof(w1),w0,'/');
    while(strstr(w0,"/") != 0) {
-      getword(w1,w0,'/');
+      getword(w1,sizeof(w1),w0,'/');
       strcat(w2,w1);
       if(access(w2, R_OK) != 0) {
          if(mkdir(w2,0755)) {
@@ -330,8 +328,8 @@ void name_month(char *month)
    strcpy(m,text[133]);
 
    for(x=0; x<z; x++)
-      getword(w,m,',');
-   getword(month,m,',');
+      getword(w,sizeof(w),m,',');
+   getword(month,sizeof(month),m,',');
 }
 
 
@@ -394,13 +392,13 @@ void fixip(char *ip)
    }
 
    if(iflag) {
-      getword(n1,wip,'.');
-      getword(n2,wip,'.');
-      getword(n3,wip,'.');
+      getword(n1,sizeof(n1),wip,'.');
+      getword(n2,sizeof(n2),wip,'.');
+      getword(n3,sizeof(n3),wip,'.');
    } else {
-      getword(n1,wip,'_');
-      getword(n2,wip,'_');
-      getword(n3,wip,'_');
+      getword(n1,sizeof(n1),wip,'_');
+      getword(n2,sizeof(n2),wip,'_');
+      getword(n3,sizeof(n3),wip,'_');
    }
    ip[0]='\0';
    sprintf(ip,"%s%s%s%s%s%s%s",n1,sep,n2,sep,n3,sep,wip);
@@ -654,11 +652,11 @@ void obttotal(char *dirname, char *name,
    }
 
    while(fgets(buf,sizeof(buf),fp_in)!=NULL) {
-      getword(warea,buf,' ');
+      getword(warea,sizeof(warea),buf,' ');
       if(strcmp(warea,"TOTAL") != 0)
          continue;
-      getword(warea,buf,' ');
-      getword(warea,buf,' ');
+      getword(warea,sizeof(warea),buf,' ');
+      getword(warea,sizeof(warea),buf,' ');
       twork=my_atoll(warea);
       sprintf(tbytes,"%s",fixnum(twork,1));
    }
@@ -892,9 +890,9 @@ void strip_latin(char *line)
    char warea[255];
 
    while(strstr(line,"&") != 0){
-      getword(warea,line,'&');
+      getword(warea,sizeof(warea),line,'&');
       strncat(warea,line,1);
-      getword(buf,line,';');
+      getword(buf,sizeof(buf),line,';');
       strcat(warea,line);
       strcpy(line,warea);
    }
@@ -976,11 +974,11 @@ void date_from(char *date, char *dfrom, 
       strcpy(date,wdate);
    }
 
-   getword(diaf,wdate,'/');
-   getword(mesf,wdate,'/');
-   getword(anof,wdate,'-');
-   getword(diau,wdate,'/');
-   getword(mesu,wdate,'/');
+   getword(diaf,sizeof(diaf),wdate,'/');
+   getword(mesf,sizeof(mesf),wdate,'/');
+   getword(anof,sizeof(anof),wdate,'-');
+   getword(diau,sizeof(diau),wdate,'/');
+   getword(mesu,sizeof(mesu),wdate,'/');
    strcpy(anou,wdate);
 
    sprintf(dfrom,"%s%s%s",anof,mesf,diaf);
@@ -1115,7 +1113,7 @@ int vercode(char *code)
 
    strcpy(warea,excludecode);
    for(z=0; z<=excode-1; z++) {
-      getword(cod,warea,';');
+      getword(cod,sizeof(cod),warea,';');
       if(strcmp(code,cod) == 0) 
          return 1;
    }
@@ -1242,7 +1240,7 @@ get_size(char *path, char *file)
    sprintf(cmd,"du -skh %s%s",path,file);
    fp = popen(cmd, "r");
    fgets(response, 255, fp);
-   getword(val5,response,'\t');
+   getword(val5,sizeof(val5),response,'\t');
    pclose(fp);
 
    return (val5);
--- sarg-2.2.5/log.c.orig	2008-04-22 15:13:55.000000000 +0200
+++ sarg-2.2.5/log.c	2008-04-22 15:20:14.000000000 +0200
@@ -916,21 +916,21 @@ int main(argc,argv)
            }
            fgets(bufz,sizeof(bufz),fp_in);
            strcpy(val1,bufz);
-           for(x=0; x<=i1-1; x++) getword3(ip,val1,'\t');
+           for(x=0; x<=i1-1; x++) getword3(ip,sizeof(ip),val1,'\t');
            strcpy(val1,bufz);
-           for(x=0; x<=i2-1; x++) getword3(user,val1,'\t');
+           for(x=0; x<=i2-1; x++) getword3(user,sizeof(user),val1,'\t');
            strcpy(val1,bufz);
-           for(x=0; x<=i3-1; x++) getword3(data,val1,'\t');
+           for(x=0; x<=i3-1; x++) getword3(data,sizeof(data),val1,'\t');
            strcpy(val1,bufz);
-           for(x=0; x<=i4-1; x++) getword3(hora,val1,'\t');
+           for(x=0; x<=i4-1; x++) getword3(hora,sizeof(hora),val1,'\t');
            strcpy(val1,bufz);
-           for(x=0; x<=i5-1; x++) getword3(elap,val1,'\t');
+           for(x=0; x<=i5-1; x++) getword3(elap,sizeof(elap),val1,'\t');
            strcpy(val1,bufz);
-           for(x=0; x<=i6-1; x++) getword3(tam,val1,'\t');
+           for(x=0; x<=i6-1; x++) getword3(tam,sizeof(tam),val1,'\t');
            strcpy(val1,bufz);
-           for(x=0; x<=i7-1; x++) getword3(url,val1,'\t');
+           for(x=0; x<=i7-1; x++) getword3(url,sizeof(url),val1,'\t');
            strcpy(val1,bufz);
-           for(x=0; x<=i8-1; x++) getword3(code,val1,'\t');
+           for(x=0; x<=i8-1; x++) getword3(code,sizeof(code),val1,'\t');
            
            if(strcmp(code,"401") == 0 || strcmp(code,"403") == 0 || strcmp(code,"407") == 0) {
               sprintf(val1,"DENIED/%s",code);
--- sarg-2.2.5/realtime.c.orig	2008-04-22 15:13:55.000000000 +0200
+++ sarg-2.2.5/realtime.c	2008-04-22 15:20:26.000000000 +0200
@@ -116,23 +116,23 @@ void getdata(char *rec, FILE *ftmp)
    time_t tt;
    struct tm *t;
 
-   getword3(dat,rec,' ');
-   getword3(warea,rec,' ');
+   getword3(dat,sizeof(dat),rec,' ');
+   getword3(warea,sizeof(warea),rec,' ');
    while(strcmp(warea,"") == 0 && strlen(rec) > 0)
-      getword3(warea,rec,' ');
-   getword3(ip,rec,' ');
-   getword3(warea,rec,' ');
-   getword3(warea,rec,' ');
-   getword3(typ,rec,' ');
+      getword3(warea,sizeof(warea),rec,' ');
+   getword3(ip,sizeof(ip),rec,' ');
+   getword3(warea,sizeof(warea),rec,' ');
+   getword3(warea,sizeof(warea),rec,' ');
+   getword3(typ,sizeof(typ),rec,' ');
    if(strncmp(typ,"CONNECT",7) == 0) {
-      getword3(url,rec,' ');
-      getword3(user,rec,' ');
+      getword3(url,sizeof(url),rec,' ');
+      getword3(user,sizeof(user),rec,' ');
     }else {
-      getword3(url,rec,'/');
-      getword3(url,rec,'/');
-      getword3(url,rec,'/');
-      getword3(user,rec,' ');
-      getword3(user,rec,' ');
+      getword3(url,sizeof(url),rec,'/');
+      getword3(url,sizeof(url),rec,'/');
+      getword3(url,sizeof(url),rec,'/');
+      getword3(user,sizeof(user),rec,' ');
+      getword3(user,sizeof(user),rec,' ');
    }
 
    if(strncmp(user,"-",1) == 0 && strcmp(RealtimeUnauthRec,"ignore") == 0)
@@ -163,13 +163,13 @@ void datashow(char *tmp)
 
    while(fgets(buf, MAXLEN, fin)) {
       buf[strlen(buf)-1]='\0';
-      getword3(dat,buf,' ');
-      getword3(tim,buf,' ');
-      getword3(ip,buf,' ');
-      getword3(user,buf,' ');
+      getword3(dat,sizeof(dat),buf,' ');
+      getword3(tim,sizeof(tim),buf,' ');
+      getword3(ip,sizeof(ip),buf,' ');
+      getword3(user,sizeof(user),buf,' ');
       if(strlen(dat) < 3 || strlen(user) < 1) continue;
-      getword3(url,buf,' ');
-      getword3(typ,buf,' ');
+      getword3(url,sizeof(url),buf,' ');
+      getword3(typ,sizeof(typ),buf,' ');
       if(strstr(RealtimeTypes,typ) == 0)
          continue;
 
--- sarg-2.2.5/util.c.orig	2008-04-22 15:13:55.000000000 +0200
+++ sarg-2.2.5/util.c	2008-04-22 15:26:56.000000000 +0200
@@ -107,11 +107,18 @@ char *  getword2(char *word, int limit, 
   return( line + x +1) ;
 }
 
-void getword3(char *word, char *line, int stop)
+void getword3(char *word, int limit, char *line, int stop)
 {
   int x = 0, y = 0;
 
-  for(x=0;(line[x] && (line[x] != stop ));x++) word[x] = line[x];
+  for(x=0;((line[x]) && (line[x] != stop && limit ));x++ , limit-- ) word[x] = line[x];
+  if(  ! limit) {
+        printf("SARG: getword3 loop detected.\n");
+        printf("SARG: Buffer=\"%s\"\n",line);
+        printf("SARG: searching for \'x%x\'\n",stop);
+        printf("SARG: Maybe you have a broken record or garbage in your log file.\n");
+        exit(1);
+  }
   word[x] = '\0';
   if(line[x]) ++x;
   while((line[y++] = line[x++]));
openSUSE Build Service is sponsored by