[tex-live] Bugs in tlmgr-gui.c
Siep Kroonenberg
siepo at cybercomm.nl
Wed May 11 18:21:31 CEST 2016
On Wed, May 11, 2016 at 06:09:02AM +0100, Samuel Neves wrote:
> Hi,
>
> I found the reason for the XP crash reported by Uwe earlier, and it's not Windows XP-related at all. Looking at tlmgr-gui.c in /trunk/Master/source/tlmgr-gui_UAC.zip, we see:
>
> char * get_tl_release() {
> // read release from release-texlive.txt in root of installation
>
> ...
>
> char relcontents[200];
>
> ...
>
> // read start of release file
> relfile = _wfopen( relfilename, L"rb" );
> i = fread( relcontents, 1, sizeof( relcontents ), relfile );
> fclose( relfile );
>
> ...
>
> cptr = strstr( relcontents, "version 2" );
>
> ...
>
> return cptr;
>
> }
>
> Two things stand out here:
>
> - The function is returning a pointer to a dangling local variable, which is undefined behavior and was working before purely by luck.
>
> - If the file 'C:\texlive\2016\release-texlive.txt' does not exist---which was the case in my installation for some reason---it will try to fread out of a NULL pointer, and this was most likely the reason for the crash observed by Uwe.
Thanks for finding the problem!
Norbert Preining suggested to me a better way to get the release.
Should be fixed soon.
--
Siep Kroonenberg
More information about the tex-live
mailing list