Commit 689959e
committed
Silece stringop-overflow warning and protect against invalid read
strncat unfortunately takes a misleading size argument which means
at most size from src. It is a bit of an antipattern in the string
family of functions and for that compilers will emit a warning if
it happens that the size argument matches the size of src, since that
is not what usually users of strncat want to do.
The usage of the function in the code was correct. However instead
of silencing the compiler, strncat was replaced with the dynamic buffer
family of operations that postgres provides for the frontend.
Also protect against an invalid read in case that the size of the
result is zero.
Reviewed-by: Asim R P <apraveen@pivotal.io>
Reviewed-by: Daniel Gustafsson <dgustafsson@pivotal.io>1 parent 6f3ed93 commit 689959e
1 file changed
Lines changed: 28 additions & 27 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1529 | 1529 | | |
1530 | 1530 | | |
1531 | 1531 | | |
1532 | | - | |
1533 | | - | |
1534 | | - | |
1535 | | - | |
1536 | | - | |
1537 | | - | |
1538 | | - | |
1539 | | - | |
1540 | | - | |
1541 | | - | |
1542 | | - | |
1543 | | - | |
1544 | | - | |
| 1532 | + | |
| 1533 | + | |
| 1534 | + | |
| 1535 | + | |
| 1536 | + | |
| 1537 | + | |
| 1538 | + | |
| 1539 | + | |
1545 | 1540 | | |
1546 | | - | |
| 1541 | + | |
| 1542 | + | |
| 1543 | + | |
| 1544 | + | |
1547 | 1545 | | |
1548 | 1546 | | |
1549 | 1547 | | |
1550 | 1548 | | |
1551 | 1549 | | |
1552 | 1550 | | |
1553 | 1551 | | |
1554 | | - | |
| 1552 | + | |
| 1553 | + | |
1555 | 1554 | | |
1556 | 1555 | | |
1557 | 1556 | | |
1558 | 1557 | | |
1559 | 1558 | | |
1560 | 1559 | | |
1561 | | - | |
| 1560 | + | |
1562 | 1561 | | |
1563 | 1562 | | |
1564 | 1563 | | |
| |||
1568 | 1567 | | |
1569 | 1568 | | |
1570 | 1569 | | |
1571 | | - | |
1572 | | - | |
1573 | | - | |
1574 | | - | |
| 1570 | + | |
| 1571 | + | |
| 1572 | + | |
| 1573 | + | |
| 1574 | + | |
| 1575 | + | |
1575 | 1576 | | |
1576 | | - | |
1577 | | - | |
| 1577 | + | |
| 1578 | + | |
1578 | 1579 | | |
1579 | 1580 | | |
1580 | 1581 | | |
1581 | 1582 | | |
1582 | | - | |
1583 | | - | |
1584 | | - | |
| 1583 | + | |
| 1584 | + | |
| 1585 | + | |
1585 | 1586 | | |
1586 | | - | |
1587 | | - | |
| 1587 | + | |
| 1588 | + | |
1588 | 1589 | | |
1589 | 1590 | | |
1590 | 1591 | | |
| |||
0 commit comments