Re: [PATCH 03/11] votequorum: Check len in send_qdevice_reconfigure

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 6/14/2013 10:18 AM, Jan Friesse wrote:
> Also return value of this call is checked.
> 
> Signed-off-by: Jan Friesse <jfriesse@xxxxxxxxxx>
> ---
>  exec/votequorum.c |   16 ++++++++++++++--
>  1 files changed, 14 insertions(+), 2 deletions(-)
> 
> diff --git a/exec/votequorum.c b/exec/votequorum.c
> index 84206c0..05eb103 100644
> --- a/exec/votequorum.c
> +++ b/exec/votequorum.c
> @@ -1308,6 +1308,16 @@ static int votequorum_exec_send_qdevice_reconfigure(const char *oldname, const c
>  
>  	ENTER();
>  
> +	if (strlen(oldname) >= VOTEQUORUM_QDEVICE_MAX_NAME_LEN) {
> +		log_printf(LOGSYS_LEVEL_ERROR, "Old qdevice name %s is too long", oldname);
> +		return -1;
> +	}
> +
> +	if (strlen(newname) >= VOTEQUORUM_QDEVICE_MAX_NAME_LEN) {
> +		log_printf(LOGSYS_LEVEL_ERROR, "New qdevice name %s is too long", newname);
> +		return -1;
> +	}
> +

NACK.. this is done in the library. we don´t receive invalid requests to
start with.

Fabio

>  	req_exec_quorum_qdevice_reconfigure.header.id = SERVICE_ID_MAKE(VOTEQUORUM_SERVICE, MESSAGE_REQ_EXEC_VOTEQUORUM_QDEVICE_RECONFIGURE);
>  	req_exec_quorum_qdevice_reconfigure.header.size = sizeof(req_exec_quorum_qdevice_reconfigure);
>  	strcpy(req_exec_quorum_qdevice_reconfigure.oldname, oldname);
> @@ -2408,8 +2418,10 @@ static void message_handler_req_lib_votequorum_qdevice_update (void *conn,
>  			error = CS_ERR_INVALID_PARAM;
>  			goto out;
>  		}
> -		votequorum_exec_send_qdevice_reconfigure(req_lib_votequorum_qdevice_update->oldname,
> -							 req_lib_votequorum_qdevice_update->newname);
> +		if (votequorum_exec_send_qdevice_reconfigure(req_lib_votequorum_qdevice_update->oldname,
> +							 req_lib_votequorum_qdevice_update->newname) != 0) {
> +			error = CS_ERR_TRY_AGAIN;
> +		}
>  	} else {
>  		error = CS_ERR_NOT_EXIST;
>  	}
> 

_______________________________________________
discuss mailing list
discuss@xxxxxxxxxxxx
http://lists.corosync.org/mailman/listinfo/discuss





[Index of Archives]     [Linux Clusters]     [Corosync Project]     [Linux USB Devel]     [Linux Audio Users]     [Photo]     [Yosemite News]    [Yosemite Photos]    [Linux Kernel]     [Linux SCSI]     [X.Org]

  Powered by Linux