Changeset 9882 in vbox
- Timestamp:
- Jun 23, 2008 2:58:51 PM (17 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/VBox/HostServices/VBoxInfoSvc.h
r9809 r9882 37 37 /** Pass the address of the console object from Main to the service */ 38 38 SET_CFGM_NODE = 1, 39 /** Get the value attached to an extra data key in the machine XML file */ 39 /** 40 * Get the value attached to an extra data key in the machine XML file. 41 * The parameter format matches that of GET_CONFIG_KEY. 42 */ 40 43 GET_CONFIG_KEY_HOST = 2, 41 /** Set the value attached to an extra data key in the machine XML file */ 44 /** 45 * Set the value attached to an extra data key in the machine XML file. 46 * The parameter format matches that of SET_CONFIG_KEY. 47 */ 42 48 SET_CONFIG_KEY_HOST = 3 43 49 }; … … 81 87 * - Less than or equal to VBOX_SHARED_INFO_KEY_MAX_LEN bytes in length 82 88 * - Zero terminated 83 * - Starting with the string VBOX_SHARED_INFO_KEY_PREFIX84 89 */ 85 90 HGCMFunctionParameter key; … … 92 97 /** 93 98 * The size of the value. If this is greater than the size of the array 94 * supplied by the guest then no data was transferred and the call must 95 * be repeated. (OUT uint32_t) 99 * supplied in the second parameter then no data was transferred and the 100 * call must be repeated. If it is zero then no value was found. 101 * (OUT uint32_t) 96 102 */ 97 103 HGCMFunctionParameter size; … … 108 114 * - Less than or equal to VBOX_SHARED_INFO_KEY_MAX_LEN bytes in length 109 115 * - Zero terminated 110 * - Starting with the string VBOX_SHARED_INFO_KEY_PREFIX111 116 */ 112 117 HGCMFunctionParameter key; … … 115 120 * The value of the key (IN pointer) 116 121 * Criteria as for the key parameter, but with length less that or equal to 117 * VBOX_SHARED_INFO_KEY_MAX_VALUE_LEN 122 * VBOX_SHARED_INFO_KEY_MAX_VALUE_LEN. A null pointer causes the value to 123 * be removed from the database. 118 124 */ 119 125 HGCMFunctionParameter value; -
trunk/src/VBox/HostServices/SharedInfoServices/service.cpp
r9810 r9882 202 202 if (RT_SUCCESS(rc) && (rc != VINF_BUFFER_OVERFLOW)) 203 203 Log2(("Queried string %s, rc=%Rrc, value=%.*s\n", pszKey, rc, cbValue, pcValue)); 204 else if (VERR_CFGM_VALUE_NOT_FOUND == rc) 205 { 206 VBoxHGCMParmUInt32Set(&paParms[2], 0); 207 rc = VINF_SUCCESS; 208 } 204 209 LogFlowThisFunc(("rc = %Rrc\n", rc)); 205 210 return rc; … … 285 290 { 286 291 CFGMR3RemoveValue(mpNode, pszKey); 287 rc = CFGMR3InsertString(mpNode, pszKey, pszValue); 292 if (pszValue > 0) 293 rc = CFGMR3InsertString(mpNode, pszKey, pszValue); 288 294 } 289 295 if (RT_SUCCESS(rc)) … … 327 333 rc = VERR_INVALID_PARAMETER; 328 334 329 /* Validate the format of the value. */ 330 /* Only accept values in printable ASCII without spaces */ 331 for (count = 0; (count < cbValue) && (pcValue[count] != '\0'); ++count) 332 if ((pcValue[count] < 33) || (pcValue[count] > 126)) 335 if (cbValue != 0) 336 { 337 /* Validate the format of the value. */ 338 /* Only accept values in printable ASCII without spaces */ 339 for (count = 0; (count < cbValue) && (pcValue[count] != '\0'); ++count) 340 if ((pcValue[count] < 33) || (pcValue[count] > 126)) 341 rc = VERR_INVALID_PARAMETER; 342 if (RT_SUCCESS(rc) && (count == cbValue)) 343 /* This would mean that no null terminator was found */ 333 344 rc = VERR_INVALID_PARAMETER; 334 if (RT_SUCCESS(rc) && (count == cbValue)) 335 /* This would mean that no null terminator was found */ 336 rc = VERR_INVALID_PARAMETER; 337 if (RT_SUCCESS(rc) && (count > KEY_MAX_VALUE_LEN)) 338 rc = VERR_INVALID_PARAMETER; 339 340 if (RT_SUCCESS(rc)) 341 LogFlow((" pcKey=%s, pcValue=%s\n", pcKey, pcValue)); 345 if (RT_SUCCESS(rc) && (count > KEY_MAX_VALUE_LEN)) 346 rc = VERR_INVALID_PARAMETER; 347 } 348 349 if (RT_SUCCESS(rc)) 350 LogFlow((" pcKey=%s, pcValue=%s\n", pcKey, cbValue > 0 ? pcValue : NULL)); 342 351 LogFlowFunc(("returning %Rrc\n", rc)); 343 352 return rc;
Note:
See TracChangeset
for help on using the changeset viewer.