OSSP CVS Repository

ossp - Check-in [4289]
Not logged in
[Honeypot]  [Browse]  [Home]  [Login]  [Reports
[Search]  [Ticket]  [Timeline
  [Patchset]  [Tagging/Branching

Check-in Number: 4289
Date: 2001-Aug-08 11:17:28 (local)
2001-Aug-08 09:17:28 (UTC)
User:simons
Branch:
Comment: - Use sizeof() instead of strlen(). - Use a test message with a zero byte in the midst of the string.
Tickets:
Inspections:
Files:
ossp-pkg/xds/regression-tests/xdr-octetstream.c      1.2->removed

ossp-pkg/xds/regression-tests/xdr-octetstream.c 1.2 -> 1.3

--- xdr-octetstream.c    2001/08/01 15:25:50     1.2
+++ xdr-octetstream.c    2001/08/08 09:17:28     1.3
@@ -35,7 +35,7 @@
     char*  buffer;
     size_t buffer_size;
 
-    char   msg[] = "Hello World";
+    char   msg[] = "Hello\000World";
     char*  new_msg;
     size_t new_msg_size;
 
@@ -53,7 +53,7 @@
         printf("Failed to register my encoding engines.\n");
         return 1;
         }
-    if (xds_encode(xds, "os", msg, strlen(msg)) != XDS_OK)
+    if (xds_encode(xds, "os", msg, sizeof(msg)-1) != XDS_OK)
         {
         printf("xds_encode() failed.\n");
         return 1;
@@ -91,7 +91,7 @@
         printf("xds_decode() failed.\n");
         return 1;
         }
-    if (new_msg_size != strlen(msg))
+    if (new_msg_size != sizeof(msg)-1)
         {
         printf("The size of the decoded message is wrong.\n");
         return 1;

CVSTrac 2.0.1