changeset 268:f049f8639dc0 noffle

[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.
author bears
date Tue, 08 Oct 2002 14:52:52 +0100
parents a53d3f2f2f38
children b3a2f710fe2c
files ChangeLog src/client.c
diffstat 2 files changed, 11 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- 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.
--- 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 )