Index: penlogd.c =================================================================== --- penlogd.c (revision 6037) +++ penlogd.c (working copy) @@ -110,28 +110,22 @@ loopflag = 0; } -static void store_web(char *b, int n, struct in_addr addr) +static void store_log(char *b, int n, struct in_addr addr) { char request[1024]; - char *p, *q; - int i, m; + char *p; + int i, m, bufLen; + if (n < 1024) + bufLen = n; + else + bufLen = 1024; + b[n] = '\0'; - if (debuglevel > 1) debug("store_web(%s, %d)", b, n); - p = strchr(b, '"'); - if (p == NULL) { - debug("bogus web line %s", b); - return; - } - p++; - q = strchr(p, '"'); - if (q == NULL) { - debug("bogus line %s", b); - return; - } - memcpy(request, p, q-p); - request[q-p] = '\0'; - if (q-p < 100) m = q-p; + if (debuglevel > 1) debug("store_log(%s, %d)", b, n); + memcpy(request, b, bufLen); + request[bufLen] = '\0'; + if (n < 100) m = n; else m = 100; i = pen_n-1; if (i < 0) i = pen_max-1; @@ -154,7 +148,7 @@ if (debuglevel) debug("Ugly"); return; } - fwrite(p, 1, n-(p-b), logfp); + fwrite(p, 1, bufLen-(p-b), logfp); } } @@ -374,7 +368,7 @@ if (b[0] == '+') { store_pen(b, n); } else { - store_web(b, n, a.sin_addr); + store_log(b, n, a.sin_addr); } }