-const char actions_rcs[] = "$Id: actions.c,v 1.61 2011/01/09 12:00:19 fabiankeil Exp $";
+const char actions_rcs[] = "$Id: actions.c,v 1.62 2011/02/14 16:01:20 fabiankeil Exp $";
 /*********************************************************************
  *
  * File        :  $Source: /cvsroot/ijbswa/current/actions.c,v $
    FILE *fp;
    struct url_actions *last_perm;
    struct url_actions *perm;
-   char  buf[BUFFER_SIZE];
+   char  *buf;
    struct file_list *fs;
    struct action_spec * cur_action = NULL;
    int cur_action_used = 0;
 
    log_error(LOG_LEVEL_INFO, "Loading actions file: %s", csp->config->actions_file[fileid]);
 
-   while (read_config_line(buf, sizeof(buf), fp, &linenum) != NULL)
+   while (read_config_line(fp, &linenum, &buf) != NULL)
    {
       if (*buf == '{')
       {
             csp->config->actions_file[fileid], mode);
          return 1; /* never get here */
       }
+      freez(buf);
    }
 
    fclose(fp);
 
-const char loadcfg_rcs[] = "$Id: loadcfg.c,v 1.110 2010/07/21 14:29:59 fabiankeil Exp $";
+const char loadcfg_rcs[] = "$Id: loadcfg.c,v 1.111 2010/08/14 23:28:52 ler762 Exp $";
 /*********************************************************************
  *
  * File        :  $Source: /cvsroot/ijbswa/current/loadcfg.c,v $
  *********************************************************************/
 struct configuration_spec * load_config(void)
 {
-   char buf[BUFFER_SIZE];
+   char *buf = NULL;
    char *p, *q;
    FILE *configfp = NULL;
    struct configuration_spec * config = NULL;
       /* Never get here - LOG_LEVEL_FATAL causes program exit */
    }
 
-   while (read_config_line(buf, sizeof(buf), configfp, &linenum) != NULL)
+   while (read_config_line(configfp, &linenum, &buf) != NULL)
    {
       char cmd[BUFFER_SIZE];
       char arg[BUFFER_SIZE];
       }
 
       /* Copy the argument into arg */
-      strlcpy(arg, p, sizeof(arg));
+      if (strlcpy(arg, p, sizeof(arg)) >= sizeof(arg))
+      {
+         log_error(LOG_LEVEL_FATAL, "Config line too long: %s", buf);
+      }
 
       /* Should never happen, but check this anyway */
       if (*cmd == '\0')
       {
+         freez(buf);
          continue;
       }
 
 
       /* Save the argument for the show-status page. */
       savearg(cmd, arg, config);
-
+      freez(buf);
    } /* end while ( read_config_line(...) ) */
 
    fclose(configfp);
 
-const char loaders_rcs[] = "$Id: loaders.c,v 1.79 2011/01/14 19:47:16 fabiankeil Exp $";
+const char loaders_rcs[] = "$Id: loaders.c,v 1.80 2011/01/22 12:30:22 fabiankeil Exp $";
 /*********************************************************************
  *
  * File        :  $Source: /cvsroot/ijbswa/current/loaders.c,v $
  *                and respects escaping of newline and comment char.
  *
  * Parameters  :
- *          1  :  buf = Buffer to use.
- *          2  :  buflen = Size of buffer in bytes.
- *          3  :  fp = File to read from
- *          4  :  linenum = linenumber in file
+ *          1  :  fp = File to read from
+ *          2  :  linenum = linenumber in file
+ *          3  :  buf = Pointer to a pointer to set to the data buffer.
  *
  * Returns     :  NULL on EOF or error
  *                Otherwise, returns buf.
  *
  *********************************************************************/
-char *read_config_line(char *buf, size_t buflen, FILE *fp, unsigned long *linenum)
+char *read_config_line(FILE *fp, unsigned long *linenum, char **buf)
 {
    jb_err err;
-   char *buf2 = NULL;
-   err = edit_read_line(fp, NULL, NULL, &buf2, NULL, linenum);
+   err = edit_read_line(fp, NULL, NULL, buf, NULL, linenum);
    if (err)
    {
       if (err == JB_ERR_MEMORY)
       {
          log_error(LOG_LEVEL_FATAL, "Out of memory loading a config file");
       }
-      return NULL;
-   }
-   else
-   {
-      assert(buf2);
-      if (strlen(buf2) + 1U > buflen)
-      {
-         log_error(LOG_LEVEL_FATAL,
-            "Max line limit reached. Linenumber: %u. Length: %u. Max length: %u.",
-            *linenum, strlen(buf2), buflen-1);
-      }
-      strlcpy(buf, buf2, buflen);
-      free(buf2);
-      return buf;
+      *buf = NULL;
    }
+   return *buf;
 }
 
 
    struct block_spec *b, *bl;
    struct url_spec **tl;
 
-   char  buf[BUFFER_SIZE], *p, *q;
+   char *buf = NULL;
    int reject, trusted;
    struct file_list *fs;
    unsigned long linenum = 0;
 
    tl = csp->config->trust_list;
 
-   while (read_config_line(buf, sizeof(buf), fp, &linenum) != NULL)
+   while (read_config_line(fp, &linenum, &buf) != NULL)
    {
       trusted = 0;
       reject  = 1;
 
       if (*buf == '~')
       {
+         char *p;
+         char *q;
+
          reject = 0;
          p = buf;
          q = p+1;
       /* skip blank lines */
       if (*buf == '\0')
       {
+         freez(buf);
          continue;
       }
 
             *tl++ = b->url;
          }
       }
+      freez(buf);
    }
 
    if(trusted_referrers >= MAX_TRUSTED_REFERRERS) 
    {
       csp->tlist = fs;
    }
-
    return(0);
 
 load_trustfile_error:
    log_error(LOG_LEVEL_FATAL, "can't load trustfile '%s': %E",
-             csp->config->trustfile);
+      csp->config->trustfile);
+   freez(buf);
    return(-1);
 
 }
    struct re_filterfile_spec *new_bl, *bl = NULL;
    struct file_list *fs;
 
-   char  buf[BUFFER_SIZE];
+   char *buf = NULL;
    int error;
    unsigned long linenum = 0;
    pcrs_job *dummy, *lastjob = NULL;
    /* 
     * Read line by line
     */
-   while (read_config_line(buf, sizeof(buf), fp, &linenum) != NULL)
+   while (read_config_line(fp, &linenum, &buf) != NULL)
    {
       int new_filter = NO_NEW_FILTER;
 
 
          log_error(LOG_LEVEL_RE_FILTER, "Reading in filter \"%s\" (\"%s\")", bl->name, bl->description);
 
+         freez(buf);
          continue;
       }
 
             bl->dynamic = 1;
             log_error(LOG_LEVEL_RE_FILTER,
                "Adding dynamic re_filter job \'%s\' to filter %s succeeded.", buf, bl->name);
+            freez(buf);
             continue;             
          }
          else if (bl->dynamic)
              */
             log_error(LOG_LEVEL_RE_FILTER,
                "Adding static re_filter job \'%s\' to dynamic filter %s succeeded.", buf, bl->name);
+            freez(buf);
             continue;
          }
 
          {
             log_error(LOG_LEVEL_ERROR,
                "Adding re_filter job \'%s\' to filter %s failed with error %d.", buf, bl->name, error);
+            freez(buf);
             continue;
          }
          else
          log_error(LOG_LEVEL_ERROR, "Ignoring job %s outside filter block in %s, line %d",
             buf, csp->config->re_filterfile[fileid], linenum);
       }
+      freez(buf);
    }
 
    fclose(fp);
 
 #ifndef LOADERS_H_INCLUDED
 #define LOADERS_H_INCLUDED
-#define LOADERS_H_VERSION "$Id: loaders.h,v 1.25 2009/05/16 13:27:20 fabiankeil Exp $"
+#define LOADERS_H_VERSION "$Id: loaders.h,v 1.26 2010/12/26 15:30:28 fabiankeil Exp $"
 /*********************************************************************
  *
  * File        :  $Source: /cvsroot/ijbswa/current/loaders.h,v $
 struct url_spec;
 
 extern unsigned int sweep(void);
-extern char *read_config_line(char *buf, size_t buflen, FILE *fp, unsigned long *linenum);
+extern char *read_config_line(FILE *fp, unsigned long *linenum, char **buf);
 extern int check_file_changed(const struct file_list * current,
                               const char * filename,
                               struct file_list ** newfl);