Re: [Sawfish] rep read-line limit |
[ Thread Index |
Date Index
| More lists.tuxfamily.org/sawfish Archives
]
- To: sawfish@xxxxxxxxxxxxxxxxxxx
- Subject: Re: [Sawfish] rep read-line limit
- From: Timo Korvola <Timo.Korvola@xxxxxx>
- Date: Fri, 23 Mar 2012 14:51:19 +0200
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:subject:date:user-agent:references:in-reply-to :mime-version:content-type:message-id; bh=HckO6ZhY5aB6qpu+vB/bgCrT9ZTlAkQd6gLn0rV3Q+Q=; b=oxxlZfPQBAHmVzuj5tRItCCV9DExMoLIlydvcIIsqvjj7dJmObziv8W+gVvUTH/+wM h9pbIOfJMywiDdX5xLoecBEmiKiinZGnOW3FCcRB11TXSsCns6+qolGs5cyjg0IllgxT jw12juQrkiyxJ2nOFu+ZNMSY1AavtXwKZ5lO0c7iPfJhV4Ak5RdnLa9G3/ExSnd941KG KY46HKj51qpLm+uJt2+lFsraQjY8Xg767kjQKqm44KXrHjZJ1n6tKQhMF7SqLADxI0Vn T6HvWTqPyk91hHBDywDcrrM6IY7k+LgbnNrE1ZAJA5qLoeAtJNasR0d6kbBwttuJtlHI 4gpQ==
On Wednesday 14 March 2012 23:10:34 Timo Korvola wrote:
> Maybe like this. Not extensively tested though, and may now run out
> of memory on very long lines.
Hm, looks like there will be an invalid memory access if EOF is
encountered immediately (readlen = offset = 0). This should fix that.
Timo
From 152ee22b4e2df0cace6f327d62f7af6cb6119211 Mon Sep 17 00:00:00 2001
From: Timo Korvola <tkorvola@xxxxxx>
Date: Fri, 23 Mar 2012 14:44:07 +0200
Subject: [PATCH] Avoid invalid memory access if readlen == 0.
---
src/streams.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/src/streams.c b/src/streams.c
index 0711975..4e9d794 100644
--- a/src/streams.c
+++ b/src/streams.c
@@ -695,7 +695,7 @@ characters can be read, return nil.
break;
}
}
- if (offbuf[readlen - 1] == '\n' || readlen < maxread)
+ if (readlen < maxread || offbuf[readlen - 1] == '\n')
{
int fulllen = offset + readlen;
repv rval = fulllen ? rep_string_dupn (fullbuf, fulllen) : Qnil;
--
1.7.2.5