This is an automated email from the git hooks/post-receive script.
teigland pushed a commit to branch master in repository sanlock.
commit a8e3e326faf4acd33562ae9e19835007f724d65f Author: David Teigland teigland@redhat.com AuthorDate: Mon Dec 2 10:09:01 2019 -0600
sanlock: check for invalid args --- src/client.c | 3 +++ src/main.c | 11 +++++++---- 2 files changed, 10 insertions(+), 4 deletions(-)
diff --git a/src/client.c b/src/client.c index 1cf6029..89fb68e 100644 --- a/src/client.c +++ b/src/client.c @@ -1909,6 +1909,9 @@ int sanlock_res_to_str(struct sanlk_resource *res, char **str_ret) char *str; int ret, len, pos, d;
+ if (!res) + return -EINVAL; + str = malloc(SANLK_MAX_RES_STR + 1); if (!str) return -ENOMEM; diff --git a/src/main.c b/src/main.c index 9538cc5..a8a0bf5 100644 --- a/src/main.c +++ b/src/main.c @@ -1402,6 +1402,7 @@ static void setup_host_name(void) struct utsname name; char uuid[37]; uuid_t uu; + int ret;
memset(rand_state, 0, sizeof(rand_state)); initstate(time(NULL), rand_state, sizeof(rand_state)); @@ -1423,8 +1424,10 @@ static void setup_host_name(void) uuid_generate(uu); uuid_unparse_lower(uu, uuid);
- snprintf(our_host_name_global, NAME_ID_SIZE, "%s.%s", - uuid, name.nodename); + ret = snprintf(our_host_name_global, NAME_ID_SIZE, "%s.", uuid); + + if (ret < NAME_ID_SIZE) + memcpy(our_host_name_global+ret, name.nodename, NAME_ID_SIZE-ret); }
static void setup_limits(void) @@ -3435,7 +3438,7 @@ out: static int do_direct_init(void) { char *res_str = NULL; - int rv; + int rv = -EINVAL;
if (com.lockspace.host_id_disk.path[0]) { if (com.sector_size) @@ -3452,7 +3455,7 @@ static int do_direct_init(void)
rv = direct_write_lockspace(&main_task, &com.lockspace, com.io_timeout_arg); - } else { + } else if (com.res_args[0]) { if (com.sector_size) com.res_args[0]->flags |= sanlk_res_sector_size_to_flag(com.sector_size); if (com.align_size)
sanlock-devel@lists.fedorahosted.org