lkml.org 
[lkml]   [2019]   [Mar]   [14]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH] libceph: Avoid a NULL pointer dereference
Date
kmalloc allocates memory for dest->name and attempts to call
memcpy without a check for failure. This patch avoids such a scenario.

Signed-off-by: Aditya Pakki <pakki001@umn.edu>
---
net/ceph/osdmap.c | 2 ++
1 file changed, 2 insertions(+)

diff --git a/net/ceph/osdmap.c b/net/ceph/osdmap.c
index 48a31dc9161c..c76a7c7e6a77 100644
--- a/net/ceph/osdmap.c
+++ b/net/ceph/osdmap.c
@@ -1901,6 +1901,8 @@ void ceph_oid_copy(struct ceph_object_id *dest,
} else {
dest->name = dest->inline_name;
}
+ if (!dest->name)
+ return;
memcpy(dest->name, src->name, src->name_len + 1);
dest->name_len = src->name_len;
}
--
2.17.1
\
 
 \ /
  Last update: 2019-03-14 22:18    [W:0.031 / U:3.840 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site