diff options
author | Volker Lendecke <vl@samba.org> | 2019-05-03 15:43:35 +0200 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 2019-05-08 16:33:25 +0000 |
commit | 08a31c9092b808a49ecdf92e8cc0ae9132ba6645 (patch) | |
tree | ae4a6a8f29adc320db3cb667dc3028f4d4c5db3c /lib/dbwrap | |
parent | 30abea8815113045b7ee075352c415fe176a48fe (diff) | |
download | samba-08a31c9092b808a49ecdf92e8cc0ae9132ba6645.tar.gz |
dbwrap: Adapt tdb_data_buf's overflow handling to modern conventions
This is the way we do it right now, avoid confusion why "tmp" might be
needed
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Diffstat (limited to 'lib/dbwrap')
-rw-r--r-- | lib/dbwrap/dbwrap.c | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/lib/dbwrap/dbwrap.c b/lib/dbwrap/dbwrap.c index ff6c9224905..5e307ee47cd 100644 --- a/lib/dbwrap/dbwrap.c +++ b/lib/dbwrap/dbwrap.c @@ -634,14 +634,12 @@ static ssize_t tdb_data_buf(const TDB_DATA *dbufs, int num_dbufs, for (i=0; i<num_dbufs; i++) { size_t thislen = dbufs[i].dsize; - size_t tmp; - tmp = needed + thislen; - if (tmp < needed) { + needed += thislen; + if (needed < thislen) { /* wrap */ return -1; } - needed = tmp; if ((thislen != 0) && (needed <= buflen)) { memcpy(p, dbufs[i].dptr, thislen); |