static int get_quorum_type(char *quorum_type, size_t quorum_type_len)
{
int err;
- char *str;
+ char *str = NULL;
if ((!quorum_type) || (quorum_type_len <= 0)) {
- errno = EINVAL;
return -1;
}
goto out;
}
+ if (!str) {
+ return -1;
+ }
+
strncpy(quorum_type, str, quorum_type_len - 1);
free(str);
char quorumtype[256];
int using_voteq;
+ memset(quorumtype, 0, sizeof(quorumtype));
+
if (get_quorum_type(quorumtype, sizeof(quorumtype))) {
return -1;
}
{
struct votequorum_info info;
int err;
- char quorum_type[256];
+ char quorumtype[256];
+
+ memset(quorumtype, 0, sizeof(quorumtype));
if (!loop) {
printf("Version: %s\n", VERSION);
- if (get_quorum_type(quorum_type, sizeof(quorum_type))) {
- strncpy(quorum_type, "Not configured", sizeof(quorum_type) - 1);
+ if (get_quorum_type(quorumtype, sizeof(quorumtype))) {
+ strncpy(quorumtype, "Not configured", sizeof(quorumtype) - 1);
}
- printf("Quorum type: %s\n", quorum_type);
+ printf("Quorum type: %s\n", quorumtype);
}
printf("Nodes: %d\n", g_view_list_entries);