Skip to content
This repository was archived by the owner on Mar 10, 2026. It is now read-only.
This repository was archived by the owner on Mar 10, 2026. It is now read-only.

tmpnam remains in pdftops/gfile.cxx:499 #406

Closed

Description

@michaelrsweet

Version: 1.1.20rc6
CUPS.org User: kmuto.debian

Hi,

I found pdftops/gfile.cxx remains insecure tmpnam using.

Warning from gcc (Debian GNU/Linux unstable gcc-3.3.2) says:
libxpdf.a(gfile.o)(.text+0x59d): In function openTempFile(GString**, _IO_FILE** , char const*, char const*)': cupsys-1.1.20candidate6/pdftops/gfile.cxx:499: warning: the use oftmpnam' is dangerous, better use `mkstemp'

The code is:
if (!(s = tmpnam(NULL))) {

Thanks,

Activity

  1. michaelrsweet commented on Nov 17, 2003

    @michaelrsweet
    ContributorAuthor

    CUPS.org User: mike

    tmpnam by itself is not insecure - the Xpdf code opens the tmpnam filename using the appropriate flags (O_EXCL and others).

    The reason for the tmpnam code was to support LZW compressed streams on platforms using the "uncompress" command. Since some implementations of "uncompress" required a trailing ".Z" on the filename, the only function capable of supporting a temporary filename of this form was tmpnam.

    That said, it appears that the LZW code is now implemented internally in Xpdf (thanks to the patent expiration... :), so I'll rip out the last vestiges of tmpnam for CUPS 1.1.20.

    Thanks!

  2. michaelrsweet commented on Nov 19, 2003

    @michaelrsweet
    ContributorAuthor

    CUPS.org User: mike

    Fixed in CVS - the anonymous CVS repository will be updated at midnight EST.

  3. added this to the Stable milestone on Mar 17, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions