- 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.
26 lines
632 B
C
26 lines
632 B
C
// gt-0011: Dead code - function never called
|
|
// Expected: UNREACHABLE (tier: imported)
|
|
// Vulnerability: CWE-120 (Buffer Copy without Checking Size)
|
|
|
|
#include <stdio.h>
|
|
#include <string.h>
|
|
|
|
// This function is NEVER called - dead code
|
|
void vulnerable_function(const char *input) {
|
|
char buffer[32];
|
|
strcpy(buffer, input); // SINK: CWE-120 (but unreachable)
|
|
printf("Value: %s\n", buffer);
|
|
}
|
|
|
|
void safe_function(const char *input) {
|
|
printf("Safe: %.31s\n", input);
|
|
}
|
|
|
|
int main(int argc, char *argv[]) {
|
|
if (argc > 1) {
|
|
// Only safe_function is called
|
|
safe_function(argv[1]);
|
|
}
|
|
return 0;
|
|
}
|