Changeset 103448 in vbox for trunk/src/VBox/NetworkServices
- Timestamp:
- Feb 19, 2024 2:20:41 PM (9 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/NetworkServices/NetLib/VBoxNetPortForwardString.cpp
r98103 r103448 75 75 AssertReturn(pszRaw[0] == PF_ADDRESS_FIELD_STARTS, -1); 76 76 77 if (pszRaw[0] == PF_ADDRESS_FIELD_STARTS) 78 { 79 /* shift pszRaw to next symbol */ 80 pszRaw++; 81 cchRaw--; 82 83 84 /* we shouldn't face with ending here */ 85 AssertReturn(cchRaw > 0, VERR_INVALID_PARAMETER); 86 87 char *pszEndOfAddress = RTStrStr(pszRaw, PF_STR_ADDRESS_FIELD_ENDS); 88 89 /* no pair closing sign */ 90 AssertPtrReturn(pszEndOfAddress, VERR_INVALID_PARAMETER); 91 92 cchField = pszEndOfAddress - pszRaw; 93 94 /* field should be less then the rest of the string */ 95 AssertReturn(cchField < cchRaw, VERR_INVALID_PARAMETER); 96 97 if (cchField != 0) 98 RTStrCopy(pszAddress, RT_MIN(cchField + 1, (size_t)cbAddress), pszRaw); 99 else if (!fEmptyAcceptable) 100 return -1; 101 } 77 /* shift pszRaw to next symbol */ 78 pszRaw++; 79 cchRaw--; 80 81 /* we shouldn't face with ending here */ 82 AssertReturn(cchRaw > 0, VERR_INVALID_PARAMETER); 83 84 char *pszEndOfAddress = RTStrStr(pszRaw, PF_STR_ADDRESS_FIELD_ENDS); 85 86 /* no pair closing sign */ 87 AssertPtrReturn(pszEndOfAddress, VERR_INVALID_PARAMETER); 88 89 cchField = pszEndOfAddress - pszRaw; 90 91 /* field should be less then the rest of the string */ 92 AssertReturn(cchField < cchRaw, VERR_INVALID_PARAMETER); 93 94 if (cchField != 0) 95 RTStrCopy(pszAddress, RT_MIN(cchField + 1, (size_t)cbAddress), pszRaw); 96 else if (!fEmptyAcceptable) 97 return -1; 102 98 103 99 AssertReturn(pszRaw[cchField] == PF_ADDRESS_FIELD_ENDS, -1); 104 105 100 return (int)cchField + 2; /* length of the field and closing braces */ 106 101 } … … 290 285 291 286 /* name */ 292 if (pszRaw[idxRaw] == PF_FIELD_SEPARATOR) 293 idxRaw = 1; /* begin of the next segment */ 294 else 287 if (pszRaw[idxRaw] != PF_FIELD_SEPARATOR) 295 288 { 296 289 char *pszEndOfName = RTStrStr(pszRaw + 1, PF_STR_FIELD_SEPARATOR); … … 377 370 invalid_parameter: 378 371 RTStrFree(pszRawBegin); 379 if (pPfr) 380 RT_ZERO(*pPfr); 372 RT_ZERO(*pPfr); 381 373 return VERR_INVALID_PARAMETER; 382 374 }
Note:
See TracChangeset
for help on using the changeset viewer.