OSSP CVS Repository

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

Check-in Number: 4184
Date: 2001-Jul-09 19:23:38 (local)
2001-Jul-09 17:23:38 (UTC)
User:simons
Branch:
Comment: Added test that return XDS_ERR_INVALID_ARG if the name argument contains illegal characters. Allowed are: "[a-zA-Z0-9_-]".
Tickets:
Inspections:
Files:
ossp-pkg/xds/register.c      1.5 -> 1.6     6 inserted, 0 deleted
ossp-pkg/xds/unregister.c      1.3 -> 1.4     6 inserted, 0 deleted

ossp-pkg/xds/register.c 1.5 -> 1.6

--- register.c   2001/07/08 15:37:13     1.5
+++ register.c   2001/07/09 17:23:38     1.6
@@ -27,6 +27,7 @@
 
 #include <stdlib.h>
 #include <string.h>
+#include <ctype.h>
 #include <assert.h>
 #include "internal.h"
 
@@ -41,6 +42,11 @@
     assert(engine != NULL);
     if (xds == NULL || name == NULL || engine == NULL)
         return XDS_ERR_INVALID_ARG;
+    for(pos = 0; name[pos] != '\0'; ++pos)
+        {
+        if (!isalnum(name[pos]) && name[pos] != '-' && name[pos] != '_')
+            return XDS_ERR_INVALID_ARG;
+        }
 
     /* Copy the name argument into our own memory. */
 


ossp-pkg/xds/unregister.c 1.3 -> 1.4

--- unregister.c 2001/07/08 16:01:37     1.3
+++ unregister.c 2001/07/09 17:23:38     1.4
@@ -27,6 +27,7 @@
 
 #include <stdlib.h>
 #include <string.h>
+#include <ctype.h>
 #include <assert.h>
 #include "internal.h"
 
@@ -41,6 +42,11 @@
     assert(name != NULL);
     if (xds == NULL || name == NULL)
         return XDS_ERR_INVALID_ARG;
+    for(pos = 0; name[pos] != '\0'; ++pos)
+        {
+        if (!isalnum(name[pos]) && name[pos] != '-' && name[pos] != '_')
+            return XDS_ERR_INVALID_ARG;
+        }
 
     /* Find the entry we're supposed to delete. */
 

CVSTrac 2.0.1