[tex-live] Bugs in tlmgr-gui.c

Samuel Neves samuel.c.p.neves at gmail.com
Wed May 11 07:09:02 CEST 2016


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.

Best regards,

Samuel Neves



More information about the tex-live mailing list