# HG changeset patch
# User bears
# Date 1034085172 -3600
# Node ID f049f8639dc0783bfad776dfe3afdd214c115e6a
# Parent  a53d3f2f2f389f0e4d8f20ad8edfa121dfe111e7
[svn] * src/client.c: Fix old bug in readField() where the last field in a line
  would not terminate the buffer properly if the line ended with \0. This
  could in practice lead to rubbish in the Lines: field, with extra
  numerals from the preceding Bytes: field being added.

diff -r a53d3f2f2f38 -r f049f8639dc0 ChangeLog
--- a/ChangeLog	Mon Aug 05 23:15:49 2002 +0100
+++ b/ChangeLog	Tue Oct 08 14:52:52 2002 +0100
@@ -1,3 +1,10 @@
+Tue Oct 8 2002 Jim Hague <jim.hague@acm.org>
+
+* src/client.c: Fix old bug in readField() where the last field in a line
+  would not terminate the buffer properly if the line ended with \0. This
+  could in practice lead to rubbish in the Lines: field, with extra
+  numerals from the preceding Bytes: field being added.
+
 Mon Aug 5 2002 Jim Hague <jim.hague@acm.org>
 
 * INSTALL,README,docs/FAQ: Remove online mode from introductory documentation.
diff -r a53d3f2f2f38 -r f049f8639dc0 src/client.c
--- a/src/client.c	Mon Aug 05 23:15:49 2002 +0100
+++ b/src/client.c	Tue Oct 08 14:52:52 2002 +0100
@@ -1,7 +1,7 @@
 /*
   client.c
 
-  $Id: client.c 382 2002-06-05 22:03:44Z mirkol $
+  $Id: client.c 400 2002-10-08 13:52:52Z bears $
 */
 
 #if HAVE_CONFIG_H
@@ -712,7 +712,10 @@
     while ( *p != '\t' && *p != '\n' )
     {
         if ( ! *p )
+	{
+	    *r = '\0';
             return p;
+	}
         *(r++) = *(p++);
         ++len;
         if ( len >= MAXCHAR - 1 )