nyx/tests/fixtures/xpath_injection/cpp/unsafe_xpath_query.cpp
2026-05-07 01:29:31 -04:00

9 lines
358 B
C++

// Unsafe: tainted env-string passed straight as the XPath expression to
// xmlXPathEvalExpression. XPATH_INJECTION fires on the expression arg.
#include <libxml/xpath.h>
#include <cstdlib>
xmlXPathObjectPtr do_lookup(xmlXPathContextPtr ctx) {
char *user_expr = std::getenv("USER_EXPR");
return xmlXPathEvalExpression((xmlChar *)user_expr, ctx);
}