Also return value of this call is checked.

Signed-off-by: Jan Friesse <[email protected]>
---
 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;
+       }
+
        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;
        }
-- 
1.7.1

_______________________________________________
discuss mailing list
[email protected]
http://lists.corosync.org/mailman/listinfo/discuss

Reply via email to