summaryrefslogtreecommitdiff
path: root/hook.c
diff options
context:
space:
mode:
authorPaulo Cesar Pereira de Andrade <pcpa@mandriva.com.br>2008-05-10 21:38:23 -0300
committerPaulo Cesar Pereira de Andrade <pcpa@mandriva.com.br>2008-07-02 19:08:17 -0300
commitc23ce2ff2439f09d00dc2c226562d44f02ca591a (patch)
treef0fd8f966a0a31cf44ce130188ff5fa663436db3 /hook.c
parent2b4ebe868b660a69800dc5fe801bbcc05ccaefac (diff)
Fix an off by one error check that can lead to an infinite loop.
This can happen when using the line edit mode to search&replace regexes.
Diffstat (limited to 'hook.c')
-rw-r--r--hook.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/hook.c b/hook.c
index 8d2eb22..7dd6da0 100644
--- a/hook.c
+++ b/hook.c
@@ -934,7 +934,9 @@ confirm_label:
}
memcpy(einfo.line, block.ptr, block.length);
length = block.length;
- for (position += length; position < to; position += block.length) {
+ for (position += length;
+ position < to && block.length;
+ position += block.length) {
XawTextSourceRead(source, position, &block, to - position);
memcpy(einfo.line + length, block.ptr, block.length);
length += block.length;