include::../description.adoc[]

include::../ask-yourself.adoc[]

include::../recommended.adoc[]

== Sensitive Code Example

----
#include <cstdio>
// ...

void f() {
  FILE * fp = fopen("/tmp/temporary_file", "r"); // Sensitive
}
----

----
#include <cstdio>
#include <cstdlib>
#include <sstream>
// ...

void f() {
  std::stringstream ss;
  ss << getenv("TMPDIR") << "/temporary_file"; // Sensitive
  FILE * fp = fopen(ss.str().c_str(), "w");
}
----

== Compliant Solution

[source,cpp]
----
#include <cstdio>
#include <cstdlib>
// ...

void f() {
  FILE * fp = tmpfile(); // Compliant
}
----

include::../see.adoc[]

ifdef::env-github,rspecator-view[]

'''
== Implementation Specification
(visible only on this page)

include::../message.adoc[]

'''
== Comments And Links
(visible only on this page)

include::../comments-and-links.adoc[]

endif::env-github,rspecator-view[]
