summaryrefslogtreecommitdiff
path: root/ctdb
diff options
context:
space:
mode:
authorAmitay Isaacs <amitay@gmail.com>2018-03-19 13:38:28 +1100
committerKarolin Seeger <kseeger@samba.org>2018-04-06 08:21:13 +0200
commitaeed66ece0220d40fe33e66f726c4638e7c02393 (patch)
tree4e5a6e4b997fdc751faf44f786cf43665258fe04 /ctdb
parent25edad412a3d503114a805b434a729d5d2786b3f (diff)
downloadsamba-aeed66ece0220d40fe33e66f726c4638e7c02393.tar.gz
ctdb-client: Do not try to allocate 0 sized record
BUG: https://bugzilla.samba.org/show_bug.cgi?id=13356 Signed-off-by: Amitay Isaacs <amitay@gmail.com> Reviewed-by: Martin Schwenke <martin@meltin.net> (cherry picked from commit 92a68af1a8473dc2a5d9d6036830f944e968606d)
Diffstat (limited to 'ctdb')
-rw-r--r--ctdb/client/client_db.c19
1 files changed, 12 insertions, 7 deletions
diff --git a/ctdb/client/client_db.c b/ctdb/client/client_db.c
index e86830e7bfb..a0c4cfed652 100644
--- a/ctdb/client/client_db.c
+++ b/ctdb/client/client_db.c
@@ -1413,14 +1413,19 @@ struct ctdb_record_handle *ctdb_fetch_lock_recv(struct tevent_req *req,
offset = ctdb_ltdb_header_len(&h->header);
data->dsize = h->data.dsize - offset;
- data->dptr = talloc_memdup(mem_ctx, h->data.dptr + offset,
- data->dsize);
- if (data->dptr == NULL) {
- TALLOC_FREE(state->h);
- if (perr != NULL) {
- *perr = ENOMEM;
+ if (data->dsize == 0) {
+ data->dptr = NULL;
+ } else {
+ data->dptr = talloc_memdup(mem_ctx,
+ h->data.dptr + offset,
+ data->dsize);
+ if (data->dptr == NULL) {
+ TALLOC_FREE(state->h);
+ if (perr != NULL) {
+ *perr = ENOMEM;
+ }
+ return NULL;
}
- return NULL;
}
}