Browse code

Clean up print statement when redirection limit is reached

git-svn: trunk@3431

Nigel Horne authored on 2007/12/18 20:03:18
Showing 2 changed files
... ...
@@ -1,3 +1,8 @@
1
+Tue Dec 18 10:23:34 GMT 2007 (njh)
2
+----------------------------------
3
+  * libclamav/mbox.c:	Clean up print statement when redirection limit is
4
+				reached
5
+
1 6
 Mon Dec 17 19:41:40 GMT 2007 (njh)
2 7
 ----------------------------------
3 8
   * libclamav:	Small code cleanups
... ...
@@ -4415,21 +4415,26 @@ getURL(struct arg *arg)
4415 4415
 						char *end;
4416 4416
 
4417 4417
 						unlink(fout);
4418
+						location += 11;
4419
+						end = location;
4420
+						while(*end && (*end != '\n'))
4421
+							end++;
4422
+						*end = '\0';
4418 4423
 						if(arg->depth >= FOLLOWURLS) {
4419 4424
 							cli_warnmsg("URL %s will not be followed to %s (FOLLOWURLS limit %d was reached)\n",
4420 4425
 								arg->url, location, FOLLOWURLS);
4421 4426
 							break;
4422 4427
 						}
4428
+						if(strcmp(location, arg->url) == 0) {
4429
+							cli_dbgmsg("URL %s redirects to itself\n",
4430
+								location);
4431
+							break;
4432
+						}
4423 4433
 
4424 4434
 						fclose(fp);
4425 4435
 						closesocket(sd);
4426 4436
 
4427
-						location += 11;
4428 4437
 						free(arg->url);
4429
-						end = location;
4430
-						while(*end && (*end != '\n'))
4431
-							end++;
4432
-						*end = '\0';
4433 4438
 						arg->url = cli_strdup(location);
4434 4439
 						arg->depth++;
4435 4440
 						cli_dbgmsg("Redirecting to %s\n", arg->url);