summaryrefslogtreecommitdiffstats
path: root/rpc/rpc-lib/src
diff options
context:
space:
mode:
authorAmar Tumballi <amar@gluster.com>2010-08-26 07:40:07 +0000
committerAnand V. Avati <avati@dev.gluster.com>2010-08-26 07:31:21 -0700
commitd23ea83d476d2d0a1672ff346a398a76952d7e09 (patch)
treeeadb40f90b662255cc9bca9fa2c708f63b90a1f1 /rpc/rpc-lib/src
parent77459d46b1b242e5a8a3f4beecfb922ee7df80b0 (diff)
rpcsvc: handle the case of null dereferencing
Signed-off-by: Amar Tumballi <amar@gluster.com> Signed-off-by: Anand V. Avati <avati@dev.gluster.com> BUG: 1446 () URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=1446
Diffstat (limited to 'rpc/rpc-lib/src')
-rw-r--r--rpc/rpc-lib/src/rpcsvc.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/rpc/rpc-lib/src/rpcsvc.c b/rpc/rpc-lib/src/rpcsvc.c
index 9ef0f352ec8..5b5c2998c5e 100644
--- a/rpc/rpc-lib/src/rpcsvc.c
+++ b/rpc/rpc-lib/src/rpcsvc.c
@@ -1157,6 +1157,8 @@ rpcsvc_fill_reply (rpcsvc_request_t *req, struct rpc_msg *reply)
return -1;
prog = rpcsvc_request_program (req);
+ if (!prog)
+ return -1;
rpc_fill_empty_reply (reply, req->xid);
@@ -1192,6 +1194,7 @@ rpcsvc_record_build_record (rpcsvc_request_t *req, size_t payload,
struct iovec recordhdr = {0, };
size_t pagesize = 0;
rpcsvc_t *svc = NULL;
+ int ret = -1;
if ((!req) || (!req->trans) || (!req->svc) || (!recbuf))
return NULL;
@@ -1207,7 +1210,10 @@ rpcsvc_record_build_record (rpcsvc_request_t *req, size_t payload,
record = iobuf_ptr (replyiob); /* Now we have it. */
/* Fill the rpc structure and XDR it into the buffer got above. */
- rpcsvc_fill_reply (req, &reply);
+ ret = rpcsvc_fill_reply (req, &reply);
+ if (ret)
+ goto err_exit;
+
recordhdr = rpcsvc_record_build_header (record, pagesize, reply,
payload);
if (!recordhdr.iov_base) {