Skip to content

Commit

Permalink
Fix static string size bug in store_timescale
Browse files Browse the repository at this point in the history
There is a compile error when built with -Wall -Werror. The host in the
format is a static string that is 100 bytes. That with the other elements
of the format couuld exceed 128 resulting in truncated output.
  • Loading branch information
tom95858 committed May 11, 2024
1 parent b544a17 commit 5aae285
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion ldms/src/contrib/store/timescale/store_timescale.c
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,7 @@ open_store(struct ldmsd_store *s, const char *container, const char *schema,
is->job_mid = -1;
is->comp_mid = -1;

char str[128];
char str[256];
snprintf(str, sizeof(str), "user=%s password=%s hostaddr=%s port=%s dbname=%s", strdup(user), password, strdup(hostaddr), strdup(port), strdup(dbname));

is->conn = PQconnectdb(str);
Expand Down

0 comments on commit 5aae285

Please sign in to comment.