Commit f428cb2
committed
gh-155877: Reject an embedded NUL in curses cell text
setcchar() stops at the first NUL, so a cell text containing one was
silently truncated: complexchar('a\0\u0301') dropped the combining
character, and complexchar('\0') built a cell with no text, whose
repr() is not a valid constructor call and which terminates the
cchar_t array passed to add_wchnstr().
The two cell construction paths, curses_cell_pack() and
complexstr_from_string(), now reject any NUL, and the shared converter
rejects a NUL inside a multi-character cell. A lone NUL still reaches
the write methods, so addch('\0') keeps writing what addch(0) writes.1 parent e3287f6 commit f428cb2
2 files changed
Lines changed: 31 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
895 | 895 | | |
896 | 896 | | |
897 | 897 | | |
| 898 | + | |
| 899 | + | |
| 900 | + | |
| 901 | + | |
| 902 | + | |
| 903 | + | |
| 904 | + | |
| 905 | + | |
| 906 | + | |
| 907 | + | |
| 908 | + | |
| 909 | + | |
| 910 | + | |
| 911 | + | |
| 912 | + | |
| 913 | + | |
| 914 | + | |
| 915 | + | |
| 916 | + | |
898 | 917 | | |
899 | 918 | | |
900 | 919 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
561 | 561 | | |
562 | 562 | | |
563 | 563 | | |
| 564 | + | |
| 565 | + | |
| 566 | + | |
| 567 | + | |
564 | 568 | | |
565 | 569 | | |
566 | 570 | | |
| |||
835 | 839 | | |
836 | 840 | | |
837 | 841 | | |
| 842 | + | |
| 843 | + | |
| 844 | + | |
| 845 | + | |
838 | 846 | | |
839 | 847 | | |
840 | 848 | | |
| |||
1318 | 1326 | | |
1319 | 1327 | | |
1320 | 1328 | | |
| 1329 | + | |
| 1330 | + | |
| 1331 | + | |
| 1332 | + | |
1321 | 1333 | | |
1322 | 1334 | | |
1323 | 1335 | | |
| |||
0 commit comments