Overview
| Artifact ID: | 7037472277487c237927bd6878377de7bdb53df0e40898a8489197d9c6a8529b |
|---|---|
| Ticket: | c9e68eb6ca40bb844b6c5d172a8e203f4b419857
tclEncoding.c: undefined behavior involving NULL pointers |
| User & Date: | apnadkarni on 2025-09-21 17:02:15 |
Changes
- icomment:
Examining the code, seems the issue is with tclUnixInit.c not checking the return value from `getenv` and passing the NULL result into the decoding routines. And looking at the Windows version, that too ignores the status code of `GetEnvironmentVariable` as well as the status code from subsequent WideCharToMultiByte(). The difference is that because of the differing API (GetEnvironmentVariable accepts an output buffer instead of returning a pointer), what is passed into the decoding routines is not NULL but a pointer to complete garbage. Stuff works because garbage path does not exist and Tcl falls back to looking into the parent directory of the executable. Definitely something in need of fixing but not in the encoding routines. Thanks for reporting.
- login: "apnadkarni"
- mimetype: "text/x-markdown"