summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAmar Tumballi <amar@gluster.com>2009-06-23 13:41:26 +0000
committerAnand V. Avati <avati@dev.gluster.com>2009-06-23 12:38:24 -0700
commit992130efe4d74dd0b69b8e899c620e5dd4786856 (patch)
tree12da1e7f8aeaf2fde03d6f387ea421c3755c721e
parentbad7fdb8e15e65f31c764f4feb0e094c11428ca4 (diff)
server-protocol: interpret the 'op' value properly when a packet is received.
Ref: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=35 The check done earlier was not handling the case when a 'op' is == MAX_VALUE (which is not defined), and used to skip to the next array (like gf_mops[MAX] == gf_cbks[0]) Signed-off-by: Anand V. Avati <avati@dev.gluster.com>
-rw-r--r--xlators/protocol/server/src/server-protocol.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/xlators/protocol/server/src/server-protocol.c b/xlators/protocol/server/src/server-protocol.c
index ba89a8f38..ee79893ff 100644
--- a/xlators/protocol/server/src/server-protocol.c
+++ b/xlators/protocol/server/src/server-protocol.c
@@ -7457,8 +7457,7 @@ protocol_server_interpret (xlator_t *this, transport_t *trans,
peerinfo = &trans->peerinfo;
switch (type) {
case GF_OP_TYPE_FOP_REQUEST:
- if ((op < 0) ||
- (op > GF_FOP_MAXVALUE)) {
+ if ((op < 0) || (op >= GF_FOP_MAXVALUE)) {
gf_log (this->name, GF_LOG_ERROR,
"invalid fop %"PRId32" from client %s",
op, peerinfo->identifier);
@@ -7475,7 +7474,7 @@ protocol_server_interpret (xlator_t *this, transport_t *trans,
break;
case GF_OP_TYPE_MOP_REQUEST:
- if (op < 0 || op > GF_MOP_MAXVALUE) {
+ if ((op < 0) || (op >= GF_MOP_MAXVALUE)) {
gf_log (this->name, GF_LOG_ERROR,
"invalid mop %"PRId32" from client %s",
op, peerinfo->identifier);
@@ -7486,7 +7485,7 @@ protocol_server_interpret (xlator_t *this, transport_t *trans,
break;
case GF_OP_TYPE_CBK_REQUEST:
- if (op < 0 || op > GF_CBK_MAXVALUE) {
+ if ((op < 0) || (op >= GF_CBK_MAXVALUE)) {
gf_log (this->name, GF_LOG_ERROR,
"invalid cbk %"PRId32" from client %s",
op, peerinfo->identifier);