Index: trunk/src/VBox/HostServices/GuestProperties/service.cpp
===================================================================
--- trunk/src/VBox/HostServices/GuestProperties/service.cpp	(revision 21627)
+++ trunk/src/VBox/HostServices/GuestProperties/service.cpp	(revision 21629)
@@ -360,10 +360,9 @@
 
 /**
- * Checking that the name passed by the guest fits our criteria for a
- * property name.
+ * Check that a string fits our criteria for a property name.
  *
  * @returns IPRT status code
- * @param   pszName   the name passed by the guest
- * @param   cbName    the number of bytes pszName points to, including the
+ * @param   pszName   the string to check, must be valid Utf8
+ * @param   cbName    the number of bytes @a pszName points to, including the
  *                    terminating '\0'
  * @thread  HGCM
@@ -372,15 +371,7 @@
 {
     LogFlowFunc(("cbName=%d\n", cbName));
-
-    /*
-     * Validate the name, checking that it's proper UTF-8 and has
-     * a string terminator.
-     */
     int rc = VINF_SUCCESS;
     if (RT_SUCCESS(rc) && (cbName < 2))
         rc = VERR_INVALID_PARAMETER;
-    if (RT_SUCCESS(rc))
-        rc = RTStrValidateEncodingEx(pszName, RT_MIN(cbName, (uint32_t) MAX_NAME_LEN),
-                                     RTSTR_VALIDATE_ENCODING_ZERO_TERMINATED);
     for (unsigned i = 0; RT_SUCCESS(rc) && i < cbName; ++i)
         if (pszName[i] == '*' || pszName[i] == '?' || pszName[i] == '|')
@@ -392,10 +383,10 @@
 
 /**
- * Check that the data passed by the guest fits our criteria for the value of
- * a guest property.
+ * Check a string fits our criteria for the value of a guest property.
  *
  * @returns IPRT status code
- * @param   pszValue  the value to store in the property
- * @param   cbValue   the number of bytes in the buffer pszValue points to
+ * @param   pszValue  the string to check, must be valid Utf8
+ * @param   cbValue   the length in bytes of @a pszValue, including the
+ *                    terminator
  * @thread  HGCM
  */
@@ -404,14 +395,7 @@
     LogFlowFunc(("cbValue=%d\n", cbValue));
 
-    /*
-     * Validate the value, checking that it's proper UTF-8 and has
-     * a string terminator.
-     */
     int rc = VINF_SUCCESS;
     if (RT_SUCCESS(rc) && cbValue == 0)
         rc = VERR_INVALID_PARAMETER;
-    if (RT_SUCCESS(rc))
-        rc = RTStrValidateEncodingEx(pszValue, RT_MIN(cbValue, (uint32_t) MAX_VALUE_LEN),
-                                     RTSTR_VALIDATE_ENCODING_ZERO_TERMINATED);
     if (RT_SUCCESS(rc))
         LogFlow(("    pszValue=%s\n", cbValue > 0 ? pszValue : NULL));
@@ -535,6 +519,6 @@
     LogFlowThisFunc(("\n"));
     if (   cParms != 4  /* Hardcoded value as the next lines depend on it. */
-        || RT_FAILURE (paParms[0].getPointer ((const void **) &pcszName, &cchName))    /* name */
-        || RT_FAILURE (paParms[1].getPointer ((void **) &pchBuf, &cchBuf))    /* buffer */
+        || RT_FAILURE (paParms[0].getString(&pcszName, &cchName))  /* name */
+        || RT_FAILURE (paParms[1].getBuffer((void **) &pchBuf, &cchBuf))  /* buffer */
        )
         rc = VERR_INVALID_PARAMETER;
@@ -619,11 +603,8 @@
     if (   RT_SUCCESS(rc)
         && (   (cParms < 2) || (cParms > 3)  /* Hardcoded value as the next lines depend on it. */
-            || RT_FAILURE(paParms[0].getPointer ((const void **) &pcszName,
-                                                 &cchName)) /* name */
-            || RT_FAILURE(paParms[1].getPointer ((const void **) &pcszValue,
-                                                 &cchValue)) /* value */
+            || RT_FAILURE(paParms[0].getString(&pcszName, &cchName))  /* name */
+            || RT_FAILURE(paParms[1].getString(&pcszValue, &cchValue))  /* value */
             || (   (3 == cParms)
-                && RT_FAILURE(paParms[2].getPointer ((const void **) &pcszFlags,
-                                                     &cchFlags)) /* flags */
+                && RT_FAILURE(paParms[2].getString(&pcszFlags, &cchFlags)) /* flags */
                )
            )
@@ -715,6 +696,5 @@
      */
     if (   (cParms != 1)  /* Hardcoded value as the next lines depend on it. */
-        || RT_FAILURE(paParms[0].getPointer ((const void **) &pcszName,
-                                             &cbName))  /* name */
+        || RT_FAILURE(paParms[0].getString(&pcszName, &cbName))  /* name */
        )
         rc = VERR_INVALID_PARAMETER;
@@ -777,7 +757,6 @@
     LogFlowThisFunc(("\n"));
     if (   (cParms != 3)  /* Hardcoded value as the next lines depend on it. */
-        || RT_FAILURE(paParms[0].getPointer ((const void **) &pcchPatterns,
-                                             &cchPatterns))  /* patterns */
-        || RT_FAILURE(paParms[1].getPointer ((void **) &pchBuf, &cchBuf))  /* return buffer */
+        || RT_FAILURE(paParms[0].getString(&pcchPatterns, &cchPatterns))  /* patterns */
+        || RT_FAILURE(paParms[1].getBuffer((void **) &pchBuf, &cchBuf))  /* return buffer */
        )
         rc = VERR_INVALID_PARAMETER;
@@ -789,15 +768,10 @@
      */
     char pszPatterns[MAX_PATTERN_LEN];
-    if (NULL == pcchPatterns)
-        pszPatterns[0] = '\0';
-    else
-    {
-        for (unsigned i = 0; i < cchPatterns - 1; ++i)
-            if (pcchPatterns[i] != '\0')
-                pszPatterns[i] = pcchPatterns[i];
-            else
-                pszPatterns[i] = '|';
-        pszPatterns[cchPatterns - 1] = '\0';
-    }
+    for (unsigned i = 0; i < cchPatterns - 1; ++i)
+        if (pcchPatterns[i] != '\0')
+            pszPatterns[i] = pcchPatterns[i];
+        else
+            pszPatterns[i] = '|';
+    pszPatterns[cchPatterns - 1] = '\0';
 
     /*
@@ -885,5 +859,5 @@
     char *pchBuf;
     uint32_t cchBuf;
-    rc = paParms[2].getPointer((void **) &pchBuf, &cchBuf);
+    rc = paParms[2].getBuffer((void **) &pchBuf, &cchBuf);
     if (RT_SUCCESS(rc))
     {
@@ -936,12 +910,7 @@
     LogFlowThisFunc(("\n"));
     if (   (cParms != 4)  /* Hardcoded value as the next lines depend on it. */
-        || RT_FAILURE(paParms[0].getPointer ((void **) &pszPatterns, &cchPatterns))  /* patterns */
-        || pszPatterns[cchPatterns - 1] != '\0'  /* The patterns string must be zero-terminated */
-/** @todo r=bird: What if cchPatterns is 0? pszPatterns is NULL then, and if it wasn't, you'd access memory
- * before what it points to. Add a getString() method? Please, check *all* similar cases.
- * Remember that the guest is not trusted. :-) */
-        || RT_FAILURE(paParms[1].getUInt64 (&u64Timestamp))  /* timestamp */
-        || RT_FAILURE(paParms[2].getPointer ((void **) &pchBuf, &cchBuf))  /* return buffer */
-        || cchBuf < 1
+        || RT_FAILURE(paParms[0].getString(&pszPatterns, &cchPatterns))  /* patterns */
+        || RT_FAILURE(paParms[1].getUInt64(&u64Timestamp))  /* timestamp */
+        || RT_FAILURE(paParms[2].getBuffer((void **) &pchBuf, &cchBuf))  /* return buffer */
        )
         rc = VERR_INVALID_PARAMETER;
@@ -1028,5 +997,5 @@
                 const char *pszPatterns;
                 uint32_t cchPatterns;
-                it->mParms[0].getPointer((void **) &pszPatterns, &cchPatterns);
+                it->mParms[0].getString(&pszPatterns, &cchPatterns);
                 if (prop.Matches(pszPatterns))
                 {
Index: trunk/src/VBox/HostServices/GuestProperties/testcase/Makefile.kmk
===================================================================
--- trunk/src/VBox/HostServices/GuestProperties/testcase/Makefile.kmk	(revision 21627)
+++ trunk/src/VBox/HostServices/GuestProperties/testcase/Makefile.kmk	(revision 21629)
@@ -23,30 +23,25 @@
 include $(KBUILD_PATH)/subheader.kmk
 
-ifdef VBOX_WITH_TESTCASES
-#
-# Case conversion testcase.
-#
-PROGRAMS += tstGuestPropSvc
-tstGuestPropSvc_TEMPLATE = VBOXR3TSTEXE
-# The second define here is to ensure that the testcase will run fast, without
-# waiting for any thread synchronisation.
-tstGuestPropSvc_DEFS     = VBOX_WITH_HGCM VBOX_GUEST_PROP_TEST_NOTHREAD
-tstGuestPropSvc_SOURCES  = tstGuestPropSvc.cpp ../service.cpp
-tstGuestPropSvc_LIBS     = $(LIB_RUNTIME)
+if defined(VBOX_WITH_TESTCASES) && !defined(VBOX_ONLY_ADDITIONS) && !defined(VBOX_ONLY_SDK)
 
-# Set this in LocalConfig.kmk if you are working on the guest property service
-# to automatically run the testcase at build time.
-ifdef VBOX_RUN_GUEST_PROPERTY_TEST
- ifndef VBOX_ONLY_SDK
-  TESTING  += $(PATH_tstGuestPropSvc)/tstGuestPropSvc.run
-  OTHERS += $(PATH_tstGuestPropSvc)/tstGuestPropSvc.run
+ # Set this in LocalConfig.kmk if you are working on the guest property
+ # service to automatically run the testcase at build time.
+ #    OTHERS += $(PATH_tstGuestPropSvc)/tstGuestPropSvc.run
+ #
+
+ PROGRAMS += tstGuestPropSvc
+ TESTING  += $(PATH_tstGuestPropSvc)/tstGuestPropSvc.run
+ tstGuestPropSvc_TEMPLATE = VBOXR3TSTEXE
+ # The second define here is to ensure that the testcase will run fast,
+ # without waiting for any thread synchronisation.
+ tstGuestPropSvc_DEFS     = VBOX_WITH_HGCM VBOX_GUEST_PROP_TEST_NOTHREAD
+ tstGuestPropSvc_SOURCES  = tstGuestPropSvc.cpp ../service.cpp
+ tstGuestPropSvc_LIBS     = $(LIB_RUNTIME)
+
 $$(PATH_tstGuestPropSvc)/tstGuestPropSvc.run: $$(INSTARGET_tstGuestPropSvc)
 	export VBOX_LOG_DEST=nofile; $(INSTARGET_tstGuestPropSvc) quiet
 	$(QUIET)$(APPEND) -t "$@" "done"
- endif
+
 endif
-
-endif # VBOX_WITH_TESTCASES
-
 
 include $(KBUILD_PATH)/subfooter.kmk
