Changeset 77815 in vbox
- Timestamp:
- Mar 20, 2019 11:56:41 PM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Runtime/common/asn1/asn1-ut-string.cpp
r76553 r77815 1240 1240 if (RT_SUCCESS(rc)) 1241 1241 break; 1242 return RTErrInfoSetF(pErrInfo, VERR_ASN1_INVALID_UTF8_STRING_ENCODING, 1243 "%s: Bad UTF-8 encoding (%Rrc)", pszErrorTag, rc);1242 return RTErrInfoSetF(pErrInfo, VERR_ASN1_INVALID_UTF8_STRING_ENCODING, "%s: Bad UTF-8 encoding (%Rrc, %.*Rhxs)", 1243 pszErrorTag, rc, pThis->Asn1Core.cb, pThis->Asn1Core.uData.pch); 1244 1244 1245 1245 case ASN1_TAG_NUMERIC_STRING: … … 1250 1250 && ch != ' ') 1251 1251 return RTErrInfoSetF(pErrInfo, VERR_ASN1_INVALID_NUMERIC_STRING_ENCODING, 1252 "%s: Bad numberic string: ch=%#x", pszErrorTag, ch); 1252 "%s: Bad numeric string: ch=%#x (pos %u in %.*Rhxs)", pszErrorTag, ch, 1253 pThis->Asn1Core.cb - cch + 1, pThis->Asn1Core.cb, pThis->Asn1Core.uData.pch); 1253 1254 } 1254 1255 break; … … 1273 1274 ) 1274 1275 return RTErrInfoSetF(pErrInfo, VERR_ASN1_INVALID_PRINTABLE_STRING_ENCODING, 1275 "%s: Bad printable string: ch=%#x", pszErrorTag, ch); 1276 "%s: Bad printable string: ch=%#x (pos %u in %.*Rhxs)", pszErrorTag, ch, 1277 pThis->Asn1Core.cb - cch + 1, pThis->Asn1Core.cb, pThis->Asn1Core.uData.pch); 1276 1278 } 1277 1279 break; … … 1282 1284 unsigned char ch = *pch++; 1283 1285 if (ch == 0 || ch >= 0x80) 1284 return RTErrInfoSetF(pErrInfo, VERR_ASN1_INVALID_IA5_STRING_ENCODING, 1285 "%s: Bad IA5 string: ch=%#x", pszErrorTag, ch); 1286 { 1287 /* Ignore C-style zero terminator as the "Microsoft ECC Product Root Certificate Authority 2018" 1288 for instance, has a policy qualifier string "http://www.microsoft.com/pkiops/Docs/Repository.htm\0" */ 1289 /** @todo should '\0' really be excluded above? */ 1290 if (ch != 0 || cch != 0) 1291 return RTErrInfoSetF(pErrInfo, VERR_ASN1_INVALID_IA5_STRING_ENCODING, 1292 "%s: Bad IA5 string: ch=%#x (pos %u in %.*Rhxs)", pszErrorTag, ch, 1293 pThis->Asn1Core.cb - cch + 1, pThis->Asn1Core.cb, pThis->Asn1Core.uData.pch); 1294 break; 1295 } 1286 1296 } 1287 1297 break; … … 1313 1323 if (ch < 0x20 || ch >= 0x7f) 1314 1324 return RTErrInfoSetF(pErrInfo, VERR_ASN1_INVALID_VISIBLE_STRING_ENCODING, 1315 "%s: Bad visible string: ch=%#x", pszErrorTag, ch); 1325 "%s: Bad visible string: ch=%#x (pos %u in %.*Rhxs)", pszErrorTag, ch, 1326 pThis->Asn1Core.cb - cch + 1, pThis->Asn1Core.cb, pThis->Asn1Core.uData.pch); 1316 1327 } 1317 1328 break; … … 1330 1341 if (!RTUniCpIsValid(uc)) 1331 1342 return RTErrInfoSetF(pErrInfo, VERR_ASN1_INVALID_UNIVERSAL_STRING_ENCODING, 1332 "%s: Bad universal string: uc=%#x", pszErrorTag, uc); 1343 "%s: Bad universal string: uc=%#x (pos %u in %.*Rhxs)", pszErrorTag, uc, 1344 pThis->Asn1Core.cb - cch + 1, pThis->Asn1Core.cb, pThis->Asn1Core.uData.pch); 1333 1345 cchUtf8 += RTUniCpCalcUtf8Len(uc); 1334 1346 … … 1340 1352 } 1341 1353 return RTErrInfoSetF(pErrInfo, VERR_ASN1_INVALID_UNIVERSAL_STRING_ENCODING, 1342 "%s: Bad universal string: size not a multiple of 4: cch=%#x", pszErrorTag, cch); 1354 "%s: Bad universal string: size not a multiple of 4: cch=%#x (%.*Rhxs)", 1355 pszErrorTag, cch, pThis->Asn1Core.cb, pThis->Asn1Core.uData.pch); 1343 1356 1344 1357 case ASN1_TAG_BMP_STRING: … … 1352 1365 if (!RTUniCpIsValid(uc)) 1353 1366 return RTErrInfoSetF(pErrInfo, VERR_ASN1_INVALID_BMP_STRING_ENCODING, 1354 "%s: Bad BMP string: uc=%#x", pszErrorTag, uc); 1367 "%s: Bad BMP string: uc=%#x (pos %u in %.*Rhxs)", pszErrorTag, uc, 1368 pThis->Asn1Core.cb - cch + 1, pThis->Asn1Core.cb, pThis->Asn1Core.uData.pch); 1355 1369 cchUtf8 += RTUniCpCalcUtf8Len(uc); 1356 1370 … … 1362 1376 } 1363 1377 return RTErrInfoSetF(pErrInfo, VERR_ASN1_INVALID_BMP_STRING_ENCODING, 1364 "%s: Bad BMP string: odd number of bytes cch=%#x", pszErrorTag, cch); 1378 "%s: Bad BMP string: odd number of bytes cch=%#x (pos %u in %.*Rhxs)", 1379 pszErrorTag, cch, pThis->Asn1Core.cb, pThis->Asn1Core.uData.pch); 1365 1380 1366 1381 default:
Note:
See TracChangeset
for help on using the changeset viewer.