printf("SARG: Maybe you have a broken record or garbage in your access.log file.\n");
exit(1);
}
- if((str=(char *) strstr(data, ".")) != (char *) NULL ) {
- if((str=(char *) strstr(str+1, ".")) != (char *) NULL ) {
+ if((str=(char *) strchr(data, '.')) != (char *) NULL ) {
+ if((str=(char *) strchr(str+1, '.')) != (char *) NULL ) {
strcpy(ip,data);
strcpy(elap,"0");
if(squid24) {
printf("SARG: Maybe you have a broken record or garbage in your %s file.\n",arq);
exit(1);
}
- if((str=(char *) strstr(bufz, " ")) != (char *) NULL ) {
+ if((str=(char *) strchr(bufz, ' ')) != (char *) NULL ) {
if (getword(code,sizeof(code),bufz,' ')<0) {
printf("SARG: Maybe you have a broken record or garbage in your %s file.\n",arq);
exit(1);
if(testvaliduserchar(user))
continue;
- if(strstr(user,"%20") != 0) {
- if (getword(w,sizeof(w),user,'%')<0) {
- printf("SARG: Maybe you have a broken user in your %s file.\n",arq);
- exit(1);
- }
- strcpy(user,w);
+ if((str = strstr(user,"%20")) != NULL) {
+ /*
+ Why is it necessary to truncate the user name at the first space ?
+
+ The old code used to truncate the user name at the first % if a %20 was
+ found anywhere in the string. That means the string could be truncated
+ at the wrong place if another % occured before the %20. This new code should
+ avoid that problem and only truncate at the space. There is no bug
+ report indicating that anybody noticed this.
+ */
+ *str='\0';
}
while(strstr(user,"%5c") != 0) {
printf("SARG: Maybe you have a broken url in your %s file.\n",arq);
exit(1);
}
- /*if (!strchr(url,'/')) {
+ /*
+ This code rejects any host without a directory. Now it
+ doesn't look necessary so it is commented out.
+ if (!strchr(url,'/')) {
if (debugm) printf("URL without directory: %s\n",url);
totregsx++;
continue;