comparison src/client.c @ 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 93d5d8b098da
children 3477050e8d10
comparison
equal deleted inserted replaced
267:a53d3f2f2f38 268:f049f8639dc0
1 /* 1 /*
2 client.c 2 client.c
3 3
4 $Id: client.c 382 2002-06-05 22:03:44Z mirkol $ 4 $Id: client.c 400 2002-10-08 13:52:52Z bears $
5 */ 5 */
6 6
7 #if HAVE_CONFIG_H 7 #if HAVE_CONFIG_H
8 #include <config.h> 8 #include <config.h>
9 #endif 9 #endif
710 *r = '\0'; 710 *r = '\0';
711 len = 0; 711 len = 0;
712 while ( *p != '\t' && *p != '\n' ) 712 while ( *p != '\t' && *p != '\n' )
713 { 713 {
714 if ( ! *p ) 714 if ( ! *p )
715 {
716 *r = '\0';
715 return p; 717 return p;
718 }
716 *(r++) = *(p++); 719 *(r++) = *(p++);
717 ++len; 720 ++len;
718 if ( len >= MAXCHAR - 1 ) 721 if ( len >= MAXCHAR - 1 )
719 { 722 {
720 *r = '\0'; 723 *r = '\0';