diff options
-rw-r--r-- | source4/lib/tdb/common/io.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/source4/lib/tdb/common/io.c b/source4/lib/tdb/common/io.c index a276a8c291..e9d4e87ac8 100644 --- a/source4/lib/tdb/common/io.c +++ b/source4/lib/tdb/common/io.c @@ -351,6 +351,11 @@ unsigned char *tdb_alloc_read(struct tdb_context *tdb, tdb_off_t offset, tdb_len { unsigned char *buf; + /* some systems don't like zero length malloc */ + if (len == 0) { + len = 1; + } + if (!(buf = malloc(len))) { /* Ensure ecode is set for log fn. */ tdb->ecode = TDB_ERR_OOM; |