summaryrefslogtreecommitdiff
path: root/pf.c
diff options
context:
space:
mode:
authorSøren Sandmann Pedersen <sandmann@daimi.au.dk>2004-10-15 00:44:08 +0000
committerSøren Sandmann Pedersen <sandmann@daimi.au.dk>2004-10-15 00:44:08 +0000
commitce64b2b312a73b9a4f266da8810ab552af4fbb1e (patch)
treed51e5d4c3140490cdcd96b3029661632890c522d /pf.c
parent8ad5d3b908d68353d407fa8f678c93320760eb12 (diff)
Thu Oct 14 20:43:03 2004 Søren Sandmann <sandmann@redhat.com>
Fix a write-to-constant-string issue. Fix several buffer overruns.
Diffstat (limited to 'pf.c')
-rw-r--r--pf.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/pf.c b/pf.c
index 2cacbdc..cfa2a90 100644
--- a/pf.c
+++ b/pf.c
@@ -87,8 +87,12 @@ void process_line (buffer)
int i;
char *cp;
- len = strlen (buffer);
-
+ /* copy buffer since it may point to unwritable date */
+ len = strlen(buffer);
+ cp = chk_malloc(len);
+ strcpy(cp, buffer);
+ buffer = cp;
+
for (i = 0; i < len; i++) { /* look for blank lines */
register char c = buffer[i];
if (!(isspace(c) || c == '\n')) break;