Commit b80cf90e authored by Per Cederqvist's avatar Per Cederqvist
Browse files

(prot_a_output_text_mapping): Fixed a bug that could cause much too

	much data to be written.
parent a7abf8db
/* /*
* $Id: prot-a-output.c,v 0.33 1998/08/07 23:08:48 ceder Exp $ * $Id: prot-a-output.c,v 0.34 1998/08/08 21:42:06 ceder Exp $
* Copyright (C) 1991, 1992, 1993, 1994, 1995, 1996 Lysator Academic Computer Association. * Copyright (C) 1991, 1992, 1993, 1994, 1995, 1996 Lysator Academic Computer Association.
* *
* This file is part of the LysKOM server. * This file is part of the LysKOM server.
...@@ -29,7 +29,7 @@ ...@@ -29,7 +29,7 @@
*/ */
static const char * static const char *
rcsid = "$Id: prot-a-output.c,v 0.33 1998/08/07 23:08:48 ceder Exp $"; rcsid = "$Id: prot-a-output.c,v 0.34 1998/08/08 21:42:06 ceder Exp $";
#include "rcs.h" #include "rcs.h"
USE(rcsid); USE(rcsid);
...@@ -930,6 +930,7 @@ prot_a_output_text_mapping(Connection *fp, ...@@ -930,6 +930,7 @@ prot_a_output_text_mapping(Connection *fp,
{ {
Local_text_no lowest; Local_text_no lowest;
Local_text_no highest; Local_text_no highest;
Local_text_no limit;
Local_text_no zeroes = 0; Local_text_no zeroes = 0;
Local_text_no nonzeroes = 0; Local_text_no nonzeroes = 0;
L2g_iterator iter; L2g_iterator iter;
...@@ -947,6 +948,8 @@ prot_a_output_text_mapping(Connection *fp, ...@@ -947,6 +948,8 @@ prot_a_output_text_mapping(Connection *fp,
highest = iter.lno; highest = iter.lno;
} }
limit = highest + 1;
/* Emit the "later-texts-exists" flag. */ /* Emit the "later-texts-exists" flag. */
mux_printf(fp, " %c", iter.search_ended ? '0' : '1'); mux_printf(fp, " %c", iter.search_ended ? '0' : '1');
...@@ -968,7 +971,7 @@ prot_a_output_text_mapping(Connection *fp, ...@@ -968,7 +971,7 @@ prot_a_output_text_mapping(Connection *fp,
mux_printf(fp, " 0 %lu {", (unsigned long)nonzeroes); mux_printf(fp, " 0 %lu {", (unsigned long)nonzeroes);
for (l2gi_searchsome(&iter, map->l2g, map->first, 0); for (l2gi_searchsome(&iter, map->l2g, map->first, limit);
!iter.search_ended; !iter.search_ended;
l2gi_next(&iter)) l2gi_next(&iter))
{ {
...@@ -985,7 +988,7 @@ prot_a_output_text_mapping(Connection *fp, ...@@ -985,7 +988,7 @@ prot_a_output_text_mapping(Connection *fp,
(unsigned long)lowest, (unsigned long)lowest,
(unsigned long)(zeroes + nonzeroes)); (unsigned long)(zeroes + nonzeroes));
highest = lowest; highest = lowest;
for (l2gi_searchsome(&iter, map->l2g, map->first, 0); for (l2gi_searchsome(&iter, map->l2g, map->first, limit);
!iter.search_ended; !iter.search_ended;
l2gi_next(&iter)) l2gi_next(&iter))
{ {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment