From: Douglas Bagnall Date: Wed, 11 Dec 2024 01:31:18 +0000 (+1300) Subject: util:datablob: data_blob_pad checks its alignment assumption X-Git-Tag: tdb-1.4.13~249 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=8b84282008dc372d67ba01c8fe256ef756c3dcfb;p=thirdparty%2Fsamba.git util:datablob: data_blob_pad checks its alignment assumption BUG: https://bugzilla.samba.org/show_bug.cgi?id=15756 Signed-off-by: Douglas Bagnall Reviewed-by: Andreas Schneider Autobuild-User(master): Andreas Schneider Autobuild-Date(master): Fri Dec 20 07:59:51 UTC 2024 on atb-devel-224 --- diff --git a/lib/util/data_blob.c b/lib/util/data_blob.c index 470aa67cc61..84e814f2ae8 100644 --- a/lib/util/data_blob.c +++ b/lib/util/data_blob.c @@ -290,7 +290,7 @@ _PUBLIC_ bool data_blob_pad(TALLOC_CTX *mem_ctx, DATA_BLOB *blob, size_t old_len = blob->length; size_t new_len = (old_len + pad - 1) & ~(pad - 1); - if (new_len < old_len) { + if (new_len < old_len || (pad & (pad - 1)) != 0) { return false; }