Skip to content

fs: clobber req->path on uv_fs_mkstemp() error #2913

@bnoordhuis

Description

@bnoordhuis

Refs: nodejs/node#33549

if (-1 === mkstemp(req->path)) {
  // req->path can contain garbage now
}

POSIX allows (but doesn't mandate) the input/output buffer to get clobbered on error, and AIX indeed does so.

To flush out portability bugs in downstream users, make libuv always clobber the buffer on error.

Alternatively, preserve req->path by operating on a copy, but that needs dynamic memory allocation and incurs the (probably minor) performance hit of two memcpys.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions