Overview
| Artifact ID: | debaa2f082285b5567a799e8e8aea004198af8f09219dec1c2d075a9c1cf3cbe |
|---|---|
| Ticket: | 183a1adcc07cddc6b55d0fc636c392ea461f1ccc
Buffer overflow in Tcl_UtfToExternal |
| User & Date: | apnadkarni on 2023-03-12 17:05:18 |
Changes
- assignee changed to: "nobody"
- closer changed to: "nobody"
- cmimetype changed to: "text/x-markdown"
- comment changed to:
When passed a one byte buffer, Tcl_UtfToExternal writes the null terminator beyond the buffer. In the TIP-656 branch, ``` % testencoding Tcl_UtfToExternal unicode A {start end} {} 1 Tcl_ExternalToUtf wrote past output buffer ``` The function is identical to the core-8-branch so the bug should appear [there](https://core.tcl-lang.org/tcl/file?ci=3a7e4c1c38532805&name=generic/tclEncoding.c&ln=1588-1592) as well. 8.6 has slightly different [code](https://core.tcl-lang.org/tcl/file?ci=0336bcea26d73927&name=generic/tclEncoding.c&ln=1418-1425) but has same issue. Basically, the encoding's nul length is subtracted from the passed destination buffer length without checking for a negative result. Subsequently the nul bytes (2 in this case) are written to the buffer. Although a single byte buffer might seem unlikely, the possibility exists in streaming operation where caller might repeatedly call the function using the same (updated) buffer until `TCL_CONVERT_NOSPACE` is returned and there happens to be just one free byte in the buffer. - foundin changed to: "8.6"
- is_private changed to: "0"
- login: "apnadkarni"
- priority changed to: "5 Medium"
- private_contact changed to: "9546e9877f1a8899e25a89082561ee694e7fb402"
- resolution changed to: "None"
- severity changed to: "Critical"
- status changed to: "Open"
- submitter changed to: "apnadkarni"
- subsystem changed to: "11. Conversions from String"
- title changed to: "Buffer overflow in Tcl_UtfToExternal"
- type changed to: "Bug"