Skip to content

Untrusted Input in Security Decision

Description

The function g_get_tmp_dir is synonymous with getenv("TMP") and should be treated as untrusted input, as it could be modified by an attacker. Possible risks include buffer overflows, malicious file usage, and unauthorized file access.

Examples

Insecure Code

c
char *tmp_dir = g_get_tmp_dir();

Secure Code

c
char *tmp_dir = getenv("TMP"); if (tmp_dir) { /* validate and sanitize tmp_dir */ }

Remediation

Validate and sanitize the input from g_get_tmp_dir to prevent potential security risks.

Rule Details

FieldValue
IDCODE-0565
CategoryInjection
SeverityHIGH
CWECWE-807
ConfidenceHIGH
ImpactHIGH
LikelihoodMEDIUM
ExploitabilityMODERATE
Tagsinjection, untrusted input
OWASPA1:2017-Injection, A03:2021-Injection