]> git.ipfire.org Git - thirdparty/sarg.git/commitdiff
Support for IPv6 addresses in Dansguardian's log
authorFrédéric Marchal <fmarchal@users.sourceforge.net>
Wed, 2 Feb 2011 14:01:07 +0000 (14:01 +0000)
committerFrédéric Marchal <fmarchal@users.sourceforge.net>
Wed, 2 Feb 2011 14:01:07 +0000 (14:01 +0000)
The buffer to hold an IP address read from Dansguardian's log wasn't
big enough to contain an IPv6 address. The reading of such log was
failing.

dansguardian_log.c

index 69c077facd971ae5c6b3828e055a6a633062bea4..081b40bd5677ce4f891c127541e16257843fafb0 100644 (file)
@@ -37,7 +37,7 @@ void dansguardian_log(void)
        char year[10], mon[10], day[10];
        char hour[15];
        char user[MAXLEN], code1[255], code2[255];
-       char ip[30];
+       char ip[45];
        char wdata[127];
        char *url;
        char tmp6[MAXLEN];
@@ -119,7 +119,7 @@ void dansguardian_log(void)
 
                if (strcmp(user,"-") == 0) {
                        strcpy(user,ip);
-                       bzero(ip, 30);
+                       ip[0]='\0';
                }
                fprintf(fp_ou,"%s\t%d\t%s\t%s\t%s\t%s\t%s\n",user,idata,hour,ip,url,code1,code2);
                dansguardian_count++;