[srm-cvs] CVS Update: - Fix bug with lengthy packets, the length was not compared corectly.

From: <d.rethans[@]jdimedia.nl>
Date: Sun Aug 25 2002 - 14:07:40 CEST

Date: Sun Aug 25 14:07:40 CEST 2002
User: Derick Rethans
Directory: srm/main/src

Log Message:
 [0.25]
 - Fix bug with lengthy packets, the length was not compared corectly.
 
Modified files:
           srm/main/src/connection.c (version: 1.66)

[FILE: /srm/main/src/connection.c]

--- srm/main/src/connection.c:1.65 Sun Aug 25 10:04:32 2002 GMT
+++ srm/main/src/connection.c Sun Aug 25 10:07:40 2002 GMT
@@ -1,4 +1,4 @@
-/* $Id: cvstemp,v 1.65 2002/08/25 12:04:32 derick Exp $ */
+/* $Id: cvstemp,v 1.66 2002/08/25 12:07:40 derick Exp $ */
 
 /* The contents of this file are subject to the Vulcan Logic Public
  * License Version 1.1 (the "License"); you may not use this file
@@ -468,6 +468,8 @@
 #endif
                 /* Checking for more data if needed */
                 if (header.data_length != 0) {
+ /* FIX ME: realloc on read instead of pre-alloc with the giving
+ * length of the data block */
                         data = malloc (header.data_length);
                         while (read_bytes < header.data_length) {
                                 n = read (fd, data + read_bytes, header.data_length - read_bytes);
@@ -476,7 +478,7 @@
                                 }
                                 read_bytes += n;
                         }
- if (n < header.data_length) {
+ if (read_bytes < header.data_length) {
                                 connection_abort_with_error (fd, "Packet is invalid");
                         }
                 }
Received on Sun Aug 25 14:44:19 2002

This archive was generated by hypermail 2.1.8 : Tue Jan 06 2009 - 11:00:06 CET