Skip to content

Commit f6eeb7a

Browse files
authored
fix(key-provider-agent): improve key provider agent robustness (#50)
* fix: add const to const variables * fix: reduce scope of request_buffer * fix: fix format
1 parent f6c673f commit f6eeb7a

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

cvmassistants/keyprovider/key-provider-agent/src/key_provider_agent.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ int app_log_level = LOG_LEVEL_INFO; // Default to INFO level
2121
do { \
2222
if (app_log_level <= associated_level) { \
2323
time_t now = time(NULL); \
24-
struct tm *t = gmtime(&now); \
24+
const struct tm *t = gmtime(&now); \
2525
char ts[24]; \
2626
strftime(ts, sizeof(ts), "%Y-%m-%d %H:%M:%S UTC", t); \
2727
printf("%-29s [%-5s] [%s:%d] " fmt "\n", ts, level, __FILE__, __LINE__, \
@@ -70,11 +70,11 @@ char *generate_random_key(void) {
7070
int push_wrapkey_to_secret_box(const char *wrapkey) {
7171
CURL *curl;
7272
CURLcode res;
73-
char request_buffer[64];
7473
long http_code = 0;
7574

7675
curl = curl_easy_init();
7776
if (curl) {
77+
char request_buffer[64];
7878
// get token
7979
curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, "POST");
8080
curl_easy_setopt(curl, CURLOPT_URL, "http://127.0.0.1:9090/secret");
@@ -147,7 +147,7 @@ int main(int argc, char **argv) {
147147
}
148148
} while (opt != -1);
149149

150-
char *wrap_key = generate_random_key();
150+
const char *wrap_key = generate_random_key();
151151
if (wrap_key == NULL) {
152152
LOG_ERROR("Failed to generate random wrap key");
153153
return -1;

0 commit comments

Comments
 (0)