diff --git a/WHATS_NEW b/WHATS_NEW index c932ec558..d5f192b39 100644 --- a/WHATS_NEW +++ b/WHATS_NEW @@ -1,5 +1,6 @@ Version 2.02.78 - ==================================== + Check reallocated buffer for NULL before use in clvmd do_command(). Fix memory leak when VG allocation policy in metadata is invalid. Ignore unrecognised allocation policy found in metadata instead of aborting. Factor out tag printing into _out_tags and avoid leaking string buffer. diff --git a/daemons/clvmd/clvmd-command.c b/daemons/clvmd/clvmd-command.c index 3500ca5d9..8d1dcff56 100644 --- a/daemons/clvmd/clvmd-command.c +++ b/daemons/clvmd/clvmd-command.c @@ -169,7 +169,8 @@ int do_command(struct local_client *client, struct clvm_header *msg, int msglen, /* Check the status of the command and return the error text */ if (status) { - *retlen = 1 + snprintf(*buf, buflen, "%s", strerror(status)); + *retlen = 1 + (*buf) ? snprintf(*buf, buflen, "%s", + strerror(status)) : -1; } return status;