Many TLS records contain variable-length fields. We currently validate the overall record length, but do so only after reading the length of the variable-length field. If the record is too short to even contain the length field, then we may read uninitialised data from beyond the end of the record. This is harmless in practice (since the subsequent overall record length check would fail regardless of the value read from the uninitialised length field), but causes warnings from some analysis tools. Fix by validating that the overall record length is sufficient to contain the length field before reading from the length field. Signed-off-by: Michael Brown <mcb30@ipxe.org>tags/v1.20.1
|
|
||
1271 |
|
1271 |
|
1272 |
|
1272 |
|
1273 |
|
1273 |
|
1274 |
|
|
|
1275 |
|
1274 |
|
1276 |
|
1275 |
|
1277 |
|
|
|
|
1276 |
|
|
1278 |
|
1277 |
|
1279 |
|
1278 |
|
1280 |
|
1279 |
|
|
|
||
1310 |
|
1309 |
|
1311 |
|
1310 |
|
1312 |
|
1311 |
|
1313 |
|
|
|
|
1312 |
|
|
1314 |
|
1313 |
|
|
1314 |
|
|
1315 |
|
1315 |
|
1316 |
|
|
|
1317 |
|
1316 |
|
1318 |
|
1317 |
|
1319 |
|
1318 |
|
1320 |
|
|
|
1321 |
|
|
|
|
1319 |
|
|
1322 |
|
1320 |
|
1323 |
|
1321 |
|
1324 |
|
1322 |
|
1325 |
|
|
|
1326 |
|
|
|
|
1323 |
|
|
|
1324 |
|
|
|
1325 |
|
|
|
1326 |
|
|
|
1327 |
|
|
1327 |
|
1328 |
|
1328 |
|
1329 |
|
1329 |
|
1330 |
|
1330 |
|
1331 |
|
|
1332 |
|
|
|
1333 |
|
|
1331 |
|
1334 |
|
1332 |
|
1335 |
|
1333 |
|
1336 |
|
|
|
||
1380 |
|
1383 |
|
1381 |
|
1384 |
|
1382 |
|
1385 |
|
1383 |
|
|
|
1384 |
|
|
|
1385 |
|
|
|
1386 |
|
|
|
1387 |
|
|
|
1388 |
|
|
|
1389 |
|
|
|
1390 |
|
|
|
|
1386 |
|
|
1391 |
|
1387 |
|
1392 |
|
1388 |
|
1393 |
|
1389 |
|
|
|
||
1402 |
|
1398 |
|
1403 |
|
1399 |
|
1404 |
|
1400 |
|
1405 |
|
|
|
1406 |
|
|
|
1407 |
|
|
|
1408 |
|
|
|
|
1401 |
|
|
|
1402 |
|
|
|
1403 |
|
|
|
1404 |
|
|
|
1405 |
|
|
|
1406 |
|
|
|
1407 |
|
|
|
1408 |
|
|
|
1409 |
|
|
|
1410 |
|
|
|
1411 |
|
|
|
1412 |
|
|
|
1413 |
|
|
|
1414 |
|
|
|
1415 |
|
|
|
1416 |
|
|
1409 |
|
1417 |
|
1410 |
|
|
|
1411 |
|
|
|
|
1418 |
|
|
1412 |
|
1419 |
|
1413 |
|
|
|
|
1420 |
|
|
1414 |
|
1421 |
|
1415 |
|
1422 |
|
1416 |
|
1423 |
|
|
1424 |
|
|
1417 |
|
1425 |
|
1418 |
|
1426 |
|
1419 |
|
1427 |
|
1420 |
|
1428 |
|
1421 |
|
1429 |
|
1422 |
|
1430 |
|
1423 |
|
|
|
|
1431 |
|
|
1424 |
|
1432 |
|
1425 |
|
1433 |
|
1426 |
|
1434 |
|
|
|
||
1428 |
|
1436 |
|
1429 |
|
1437 |
|
1430 |
|
1438 |
|
1431 |
|
|
|
|
1439 |
|
|
|
1440 |
|
|
1432 |
|
1441 |
|
1433 |
|
1442 |
|
1434 |
|
1443 |
|
1435 |
|
1444 |
|
1436 |
|
1445 |
|
1437 |
|
1446 |
|
|
1447 |
|
|
1438 |
|
1448 |
|
1439 |
|
1449 |
|
1440 |
|
1450 |
|
|
|
||
1455 |
|
1465 |
|
1456 |
|
1466 |
|
1457 |
|
1467 |
|
1458 |
|
|
|
1459 |
|
|
|
|
1468 |
|
|
1460 |
|
1469 |
|
1461 |
|
1470 |
|
1462 |
|
|
|
1463 |
|
|
|
|
1471 |
|
|
|
1472 |
|
|
|
1473 |
|
|
|
1474 |
|
|
|
1475 |
|
|
|
1476 |
|
|
|
1477 |
|
|
|
1478 |
|
|
|
1479 |
|
|
1464 |
|
1480 |
|
1465 |
|
1481 |
|
1466 |
|
1482 |
|
|
|
||
1521 |
|
1537 |
|
1522 |
|
1538 |
|
1523 |
|
1539 |
|
1524 |
|
|
|
1525 |
|
1540 |
|
1526 |
|
1541 |
|
1527 |
|
1542 |
|
1528 |
|
|
|
|
1543 |
|
|
1529 |
|
1544 |
|
1530 |
|
1545 |
|
1531 |
|
1546 |
|
|
|
||
1557 |
|
1572 |
|
1558 |
|
1573 |
|
1559 |
|
1574 |
|
1560 |
|
|
|
1561 |
|
1575 |
|
1562 |
|
1576 |
|
1563 |
|
1577 |
|
1564 |
|
1578 |
|
1565 |
|
|
|
|
1579 |
|
|
1566 |
|
1580 |
|
1567 |
|
1581 |
|
1568 |
|
1582 |
|
|
|
||
1598 |
|
1612 |
|
1599 |
|
1613 |
|
1600 |
|
1614 |
|
1601 |
|
|
|
|
1615 |
|
|
1602 |
|
1616 |
|
1603 |
|
1617 |
|
1604 |
|
|
|
|
1618 |
|
|
1605 |
|
1619 |
|
1606 |
|
1620 |
|
1607 |
|
1621 |
|
1608 |
|
1622 |
|
1609 |
|
1623 |
|
1610 |
|
|
|
1611 |
|
|
|
1612 |
|
|
|
|
1624 |
|
|
|
1625 |
|
|
|
1626 |
|
|
1613 |
|
1627 |
|
1614 |
|
|
|
1615 |
|
|
|
|
1628 |
|
|
|
1629 |
|
|
|
1630 |
|
|
|
1631 |
|
|
|
1632 |
|
|
|
1633 |
|
|
|
1634 |
|
|
|
1635 |
|
|
|
1636 |
|
|
1616 |
|
1637 |
|
1617 |
|
1638 |
|
1618 |
|
1639 |
|
1619 |
|
1640 |
|
1620 |
|
1641 |
|
|
1642 |
|
|
|
1643 |
|
|
1621 |
|
1644 |
|
|
1645 |
|
|
1622 |
|
1646 |
|
1623 |
|
1647 |
|
1624 |
|
1648 |
|
|
|
||
1648 |
|
1672 |
|
1649 |
|
1673 |
|
1650 |
|
1674 |
|
1651 |
|
|
|
1652 |
|
|
|
1653 |
|
|
|
|
1675 |
|
|
1654 |
|
1676 |
|
1655 |
|
1677 |
|
1656 |
|
1678 |
|
1657 |
|
1679 |
|
1658 |
|
1680 |
|
1659 |
|
1681 |
|
1660 |
|
|
|
|
1682 |
|
|
|
1683 |
|
|
1661 |
|
1684 |
|
1662 |
|
1685 |
|
1663 |
|
1686 |
|