Commit 9293668
committed
fix: NULL dereferences and unchecked allocations parsing index XML
Four defects reachable from a crafted or truncated index while
mounting:
- xml_next_tag passed the node name to strcmp; libxml2 returns NULL
for some node types. Skip NULL names.
- decode_entry_name wrote to a percent-decode buffer allocated from an
attacker-controlled length without checking the allocation. Return
-LTFS_NO_MEMORY instead.
- the glob_patterns array growth assigned realloc straight back and
dereferenced it; on failure the old pointer leaked and the next
write dereferenced NULL. Use a temporary and fail cleanly.
- an <xattr> named ltfs.vendor.IBM.immutable or appendonly with an
empty (self-closing) value set xattr->value to NULL, which was then
passed to strcmp when deciding the WORM flags, crashing the mount.
Guard the value.1 parent 1684f9c commit 9293668
2 files changed
Lines changed: 18 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
115 | 115 | | |
116 | 116 | | |
117 | 117 | | |
118 | | - | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
119 | 121 | | |
120 | 122 | | |
121 | 123 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
98 | 98 | | |
99 | 99 | | |
100 | 100 | | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
101 | 105 | | |
102 | 106 | | |
103 | 107 | | |
| |||
575 | 579 | | |
576 | 580 | | |
577 | 581 | | |
578 | | - | |
579 | | - | |
| 582 | + | |
| 583 | + | |
| 584 | + | |
| 585 | + | |
| 586 | + | |
| 587 | + | |
| 588 | + | |
| 589 | + | |
| 590 | + | |
580 | 591 | | |
581 | 592 | | |
582 | 593 | | |
| |||
863 | 874 | | |
864 | 875 | | |
865 | 876 | | |
866 | | - | |
| 877 | + | |
867 | 878 | | |
868 | 879 | | |
869 | | - | |
| 880 | + | |
870 | 881 | | |
871 | 882 | | |
872 | 883 | | |
| |||
0 commit comments