Skip to content

Improve handling of dynamicaly extracted native library #985

@nextgens

Description

@nextgens
  1. Problem Statement

JNA creates a temporary folder at a known location (harcoded path: /tmp/jna) to do its deed.
Unlike the system's temporary folder, it doesn't set the sticky bit on it... so on multi user systems, several problems arise :

  1. Suggested changes

I've located at least two separate occurences of the problem:

static File getTempDir() throws IOException {
(runtime error + security vulnerability)
private void createDir() throws FileNotFoundException {
(just a security vulnerability)

In both cases, the easy fix is to make the directory name "instance" specific with an unpredictable path:
https://docs.oracle.com/javase/7/docs/api/java/nio/file/Files.html#createTempDirectory(java.lang.String,%20java.nio.file.attribute.FileAttribute...)

  1. Version information

Seems irrelevant... but it does affect 4.5.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions