Changeset 51253 in vbox for trunk/src/VBox/Additions/WINNT/SharedFolders
- Timestamp:
- May 14, 2014 7:38:18 PM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/WINNT/SharedFolders/driver/net.c
r51245 r51253 176 176 177 177 RootNameLength = pNetRoot->pNetRootName->Length - pSrvCall->pSrvCallName->Length; 178 if ( !RootNameLength)178 if (RootNameLength < sizeof(WCHAR)) 179 179 { 180 180 /* Refuse a netroot path with an empty shared folder name */ … … 187 187 188 188 RootNameLength -= sizeof(WCHAR); /* Remove leading backslash. */ 189 190 189 pRootName = (PWCHAR)(pNetRoot->pNetRootName->Buffer + (pSrvCall->pSrvCallName->Length / sizeof(WCHAR))); 191 190 pRootName++; /* Remove leading backslash. */ 192 191 192 /* Strip the trailing \0. Sometimes there is one, sometimes not... */ 193 if ( RootNameLength >= sizeof(WCHAR) 194 && pRootName[RootNameLength / sizeof(WCHAR) - 1] == 0) 195 RootNameLength -= sizeof(WCHAR); 196 193 197 if (pNetRootExtension->phgcmClient == NULL) 194 198 { … … 196 200 RootNameLength, RootNameLength / sizeof(WCHAR), pRootName)); 197 201 198 /* Calculate length required for parsed path. 199 */ 200 ParsedPathSize = sizeof(*ParsedPath) + RootNameLength + sizeof(WCHAR); 201 202 /* Calculate the length required for parsed path. */ 203 ParsedPathSize = sizeof(SHFLSTRING) + RootNameLength + sizeof(WCHAR); 202 204 ParsedPath = (PSHFLSTRING)vbsfAllocNonPagedMem(ParsedPathSize); 203 205 if (!ParsedPath) … … 209 211 210 212 ShflStringInitBuffer(ParsedPath, ParsedPathSize - sizeof(SHFLSTRING)); 211 212 213 ParsedPath->u16Size = (uint16_t)RootNameLength + sizeof(WCHAR); 213 214 ParsedPath->u16Length = ParsedPath->u16Size - sizeof(WCHAR); /* without terminating null */
Note:
See TracChangeset
for help on using the changeset viewer.