projects
/
privoxy.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
f2f1071
)
Fixed ugly indentation of my last changes
author
oes
<oes@users.sourceforge.net>
Wed, 23 May 2001 12:27:33 +0000
(12:27 +0000)
committer
oes
<oes@users.sourceforge.net>
Wed, 23 May 2001 12:27:33 +0000
(12:27 +0000)
loaders.c
patch
|
blob
|
history
diff --git
a/loaders.c
b/loaders.c
index
a485d93
..
8a24af2
100644
(file)
--- a/
loaders.c
+++ b/
loaders.c
@@
-1,4
+1,4
@@
-const char loaders_rcs[] = "$Id: loaders.c,v 1.
4 2001/05/22 18:56:28
oes Exp $";
+const char loaders_rcs[] = "$Id: loaders.c,v 1.
5 2001/05/23 10:39:05
oes Exp $";
/*********************************************************************
*
* File : $Source: /cvsroot/ijbswa/current/loaders.c,v $
/*********************************************************************
*
* File : $Source: /cvsroot/ijbswa/current/loaders.c,v $
@@
-35,6
+35,13
@@
const char loaders_rcs[] = "$Id: loaders.c,v 1.4 2001/05/22 18:56:28 oes Exp $";
*
* Revisions :
* $Log: loaders.c,v $
*
* Revisions :
* $Log: loaders.c,v $
+ * Revision 1.5 2001/05/23 10:39:05 oes
+ * - Added support for escaping the comment character
+ * in config files by a backslash
+ * - Added support for line continuation in config
+ * files
+ * - Fixed a buffer overflow bug with long config lines
+ *
* Revision 1.4 2001/05/22 18:56:28 oes
* CRLF -> LF
*
* Revision 1.4 2001/05/22 18:56:28 oes
* CRLF -> LF
*
@@
-733,7
+740,7
@@
char *read_config_line(char *buf, int buflen, FILE *fp, struct file_list *fs)
char linebuf[BUFSIZ];
int contflag = 0;
char linebuf[BUFSIZ];
int contflag = 0;
-
*buf = '\0';
+ *buf = '\0';
while (fgets(linebuf, sizeof(linebuf), fp))
{
while (fgets(linebuf, sizeof(linebuf), fp))
{
@@
-757,27
+764,27
@@
char *read_config_line(char *buf, int buflen, FILE *fp, struct file_list *fs)
}
/* Line continuation? Trim escape and set flag. */
}
/* Line continuation? Trim escape and set flag. */
-
if ((p != linebuf) && (*--p == '\\'))
-
{
-
contflag = 1;
-
*p = '\0';
-
}
+ if ((p != linebuf) && (*--p == '\\'))
+ {
+ contflag = 1;
+ *p = '\0';
+ }
/* If there's a comment char.. */
if ((p = strpbrk(linebuf, "#")) != NULL)
{
/* If there's a comment char.. */
if ((p = strpbrk(linebuf, "#")) != NULL)
{
-
/* ..and it's escaped, left-shift the line over the escape. */
-
if ((p != linebuf) && (*(p-1) == '\\'))
-
{
-
q = p-1;
-
while ((*q++ = *p++) != '\0') /* nop */;
-
}
-
/* Else, chop off the rest of the line */
-
else
-
{
-
*p = '\0';
-
}
-
}
+ /* ..and it's escaped, left-shift the line over the escape. */
+ if ((p != linebuf) && (*(p-1) == '\\'))
+ {
+ q = p-1;
+ while ((*q++ = *p++) != '\0') /* nop */;
+ }
+ /* Else, chop off the rest of the line */
+ else
+ {
+ *p = '\0';
+ }
+ }
/* Trim leading whitespace */
p = linebuf;
/* Trim leading whitespace */
p = linebuf;
@@
-818,16
+825,16
@@
char *read_config_line(char *buf, int buflen, FILE *fp, struct file_list *fs)
/* More paranoia. This if statement is always true. */
if (*linebuf)
{
/* More paranoia. This if statement is always true. */
if (*linebuf)
{
-
strncat(buf, linebuf, buflen - strlen(buf));
-
if (contflag)
-
{
-
contflag = 0;
-
continue;
-
}
-
else
-
{
-
return buf;
-
}
+ strncat(buf, linebuf, buflen - strlen(buf));
+ if (contflag)
+ {
+ contflag = 0;
+ continue;
+ }
+ else
+ {
+ return buf;
+ }
}
}
}
}
}
}