dbwrap backends are unlikely to be able to store
UINT32_MAX*DBWRAP_WATCHER_BUF_LENGTH in a single record
and most likely also not with the whole database!
DBWRAP_MAX_WATCHERS = INT32_MAX/DBWRAP_WATCHER_BUF_LENGTH should be
enough and makes further changes easier as we don't need to care
about size_t overflows.
BUG: https://bugzilla.samba.org/show_bug.cgi?id=15125
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
};
#define DBWRAP_WATCHER_BUF_LENGTH (SERVER_ID_BUF_LENGTH + sizeof(uint64_t))
+#define DBWRAP_MAX_WATCHERS (INT32_MAX/DBWRAP_WATCHER_BUF_LENGTH)
/*
* Watched records contain a header of:
dbufs[1].dsize = num_watchers * DBWRAP_WATCHER_BUF_LENGTH;
- if (num_watchers >= UINT32_MAX) {
+ if (num_watchers >= DBWRAP_MAX_WATCHERS) {
DBG_DEBUG("Can't handle %zu watchers\n",
num_watchers+1);
state->status = NT_STATUS_INSUFFICIENT_RESOURCES;