r93217 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r93216‎ | r93217 | r93218 >
Date:17:21, 26 July 2011
Author:platonides
Status:ok
Tags:
Comment:
buff_status was never checked
Modified paths:
  • /trunk/debs/squid/redirector.c (modified) (history)

Diff [purge]

Index: trunk/debs/squid/redirector.c
@@ -11,6 +11,7 @@
1212 #include <stdio.h>
1313 #include <stdlib.h>
1414 #include <string.h>
 15+#include <malloc.h>
1516 #include <pcre.h>
1617
1718 #define MAX_BUFF 8256
@@ -62,11 +63,10 @@
6364
6465 struct IN_BUFF *in_buff = NULL;
6566 in_buff = (struct IN_BUFF *)malloc(sizeof(struct IN_BUFF));
66 - in_buff->url = (char *)malloc(MAX_BUFF);
67 - in_buff->src_address = (char *)malloc(MAX_BUFF);
68 - in_buff->ident = (char *)malloc(MAX_BUFF);
69 - in_buff->method = (char *)malloc(MAX_BUFF);
70 - int buff_status = 0;
 67+ in_buff->url = malloc(MAX_BUFF);
 68+ in_buff->src_address = malloc(MAX_BUFF);
 69+ in_buff->ident = malloc(MAX_BUFF);
 70+ in_buff->method = malloc(MAX_BUFF);
7171 pattern = "^http:\\/\\/(\\w+)\\.wikipedia\\.org[:\\d]*\\/(.*)";
7272 pcre_extra *pe;
7373
@@ -92,7 +92,10 @@
9393
9494 while(fgets(buff, MAX_BUFF, stdin) != NULL) {
9595
96 - buff_status = load_in_buff(buff, in_buff);
 96+ if (load_in_buff(buff, in_buff) != 0) {
 97+ fprintf(stderr, "Error loading data %s\n", buff);
 98+ continue;
 99+ }
97100
98101 subject_length = (int)strlen(in_buff->url);
99102

Status & tagging log