Changeset 51014 in vbox
- Timestamp:
- Apr 9, 2014 2:30:39 PM (11 years ago)
- svn:sync-xref-src-repo-rev:
- 93216
- Location:
- trunk
- Files:
-
- 3 edited
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/VBox/shflsvc.h
r44528 r51014 205 205 206 206 /** 207 * Validates a HGCM string parameter.207 * Validates a HGCM string output parameter. 208 208 * 209 209 * @returns true if valid, false if not. … … 212 212 * @param cbBuf The buffer size from the parameter. 213 213 */ 214 DECLINLINE(bool) ShflStringIsValid (PCSHFLSTRING pString, uint32_t cbBuf)214 DECLINLINE(bool) ShflStringIsValidOut(PCSHFLSTRING pString, uint32_t cbBuf) 215 215 { 216 216 if (RT_UNLIKELY(cbBuf <= RT_UOFFSETOF(SHFLSTRING, String))) … … 220 220 if (RT_UNLIKELY(pString->u16Length >= pString->u16Size)) 221 221 return false; 222 /** @todo r=bird: Check that u16Length is a multiple of two if UTF-16 input? */223 /** @todo r=bird: Do we require the string to have a NUL terminator char, if224 * so check for it!! (Just had a problem with too small (/2) u16Length225 * and code behaving incorrectly because it worked up to the terminator226 * instead of the length.) */227 /** @todo r=bird: Who checks for valid UTF-8 encoding of strings? */228 222 return true; 229 223 } 230 224 231 225 /** 232 * Validates an optional HGCM string parameter. 226 * Validates a HGCM string input parameter. 227 * 228 * @returns true if valid, false if not. 229 * 230 * @param pString The string buffer pointer. 231 * @param cbBuf The buffer size from the parameter. 232 * @param fUtf8Not16 Set if UTF-8 encoding, clear if UTF-16 encoding. 233 */ 234 DECLINLINE(bool) ShflStringIsValidIn(PCSHFLSTRING pString, uint32_t cbBuf, bool fUtf8Not16) 235 { 236 int rc; 237 if (RT_UNLIKELY(cbBuf <= RT_UOFFSETOF(SHFLSTRING, String))) 238 return false; 239 if (RT_UNLIKELY((uint32_t)pString->u16Size + RT_UOFFSETOF(SHFLSTRING, String) > cbBuf)) 240 return false; 241 if (fUtf8Not16) 242 { 243 /* UTF-8: */ 244 if (RT_UNLIKELY(pString->u16Length >= pString->u16Size)) 245 return false; 246 rc = RTStrValidateEncodingEx((const char *)&pString->String.utf8[0], pString->u16Length + 1, 247 RTSTR_VALIDATE_ENCODING_EXACT_LENGTH | RTSTR_VALIDATE_ENCODING_ZERO_TERMINATED); 248 } 249 else 250 { 251 /* UTF-16: */ 252 if (RT_UNLIKELY(pString->u16Length & 1)) 253 return false; 254 if (RT_UNLIKELY((uint32_t)sizeof(RTUTF16) + pString->u16Length > pString->u16Size)) 255 return false; 256 rc = RTUtf16ValidateEncodingEx(&pString->String.ucs2[0], pString->u16Length / 2 + 1, 257 RTSTR_VALIDATE_ENCODING_EXACT_LENGTH | RTSTR_VALIDATE_ENCODING_ZERO_TERMINATED); 258 } 259 if (RT_FAILURE(rc)) 260 return false; 261 return true; 262 } 263 264 /** 265 * Validates an optional HGCM string input parameter. 233 266 * 234 267 * @returns true if valid, false if not. … … 236 269 * @param pString The string buffer pointer. Can be NULL. 237 270 * @param cbBuf The buffer size from the parameter. 238 */ 239 DECLINLINE(bool) ShflStringIsValidOrNull(PCSHFLSTRING pString, uint32_t cbBuf) 271 * @param fUtf8Not16 Set if UTF-8 encoding, clear if UTF-16 encoding. 272 */ 273 DECLINLINE(bool) ShflStringIsValidOrNullIn(PCSHFLSTRING pString, uint32_t cbBuf, bool fUtf8Not16) 240 274 { 241 275 if (pString) 242 return ShflStringIsValid (pString, cbBuf);276 return ShflStringIsValidIn(pString, cbBuf, fUtf8Not16); 243 277 if (RT_UNLIKELY(cbBuf > 0)) 244 278 return false; -
trunk/src/VBox/Main/src-server/ApplianceImplImport.cpp
r50904 r51014 47 47 #include <VBox/settings.h> 48 48 49 #include <iprt/x509 .h>49 #include <iprt/x509-branch-collision.h> 50 50 #include <set> 51 51 -
trunk/src/VBox/Runtime/common/checksum/x509.cpp
r50954 r51014 30 30 *******************************************************************************/ 31 31 #include "internal/iprt.h" 32 #include <iprt/x509 .h>32 #include <iprt/x509-branch-collision.h> 33 33 34 34 #include <iprt/assert.h>
Note:
See TracChangeset
for help on using the changeset viewer.