- Add RateLimitConfig for configuration management with YAML binding support. - Introduce RateLimitDecision to encapsulate the result of rate limit checks. - Implement RateLimitMetrics for OpenTelemetry metrics tracking. - Create RateLimitMiddleware for enforcing rate limits on incoming requests. - Develop RateLimitService to orchestrate instance and environment rate limit checks. - Add RateLimitServiceCollectionExtensions for dependency injection registration.
32 lines
703 B
C
32 lines
703 B
C
// gt-0005: Recursive function with sink
|
|
// Expected: REACHABLE (tier: executed)
|
|
// Vulnerability: CWE-134 (Format String)
|
|
|
|
#include <stdio.h>
|
|
#include <string.h>
|
|
|
|
char result[1024];
|
|
|
|
void process_recursive(const char *input, int depth) {
|
|
if (depth <= 0 || strlen(input) == 0) {
|
|
return;
|
|
}
|
|
|
|
// Vulnerable: format string in recursive context
|
|
sprintf(result + strlen(result), input); // SINK: CWE-134
|
|
|
|
// Recurse with modified input
|
|
process_recursive(input + 1, depth - 1);
|
|
}
|
|
|
|
int main(int argc, char *argv[]) {
|
|
result[0] = '\0';
|
|
|
|
if (argc > 1) {
|
|
process_recursive(argv[1], 5);
|
|
printf("Result: %s\n", result);
|
|
}
|
|
|
|
return 0;
|
|
}
|