Changeset 66445 in vbox for trunk/src/VBox/Runtime/common/net/netaddrstr2.cpp
- Timestamp:
- Apr 5, 2017 5:53:05 PM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Runtime/common/net/netaddrstr2.cpp
r65579 r66445 159 159 if (pMask->u == 0) 160 160 { 161 162 163 161 if (piPrefix != NULL) 162 *piPrefix = 0; 163 return VINF_SUCCESS; 164 164 } 165 165 … … 169 169 int iPrefixLen = 32; 170 170 171 while (iPrefixLen > 0) { 172 if (uMask == uPrefixMask) 173 { 174 if (piPrefix != NULL) 175 *piPrefix = iPrefixLen; 176 return VINF_SUCCESS; 177 } 178 179 --iPrefixLen; 180 uPrefixMask <<= 1; 171 while (iPrefixLen > 0) 172 { 173 if (uMask == uPrefixMask) 174 { 175 if (piPrefix != NULL) 176 *piPrefix = iPrefixLen; 177 return VINF_SUCCESS; 178 } 179 180 --iPrefixLen; 181 uPrefixMask <<= 1; 181 182 } 182 183 … … 191 192 192 193 if (RT_UNLIKELY(iPrefix < 0 || 32 < iPrefix)) 193 194 return VERR_INVALID_PARAMETER; 194 195 195 196 if (RT_LIKELY(iPrefix != 0)) 196 197 pMask->u = RT_H2N_U32(UINT32_C(0xffffffff) << (32 - iPrefix)); 197 198 else /* avoid UB in the shift */ 198 199 pMask->u = 0; 199 200 200 201 return VINF_SUCCESS; … … 255 256 int rc; 256 257 257 memset(&ipv6, 0, sizeof(ipv6));258 RT_ZERO(ipv6); 258 259 259 260 pcszPos = pcszAddr; … … 326 327 int j; 327 328 328 memset(&ipv6Tail, 0, sizeof(ipv6Tail));329 RT_ZERO(ipv6Tail); 329 330 330 331 /*
Note:
See TracChangeset
for help on using the changeset viewer.