]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
util:datablob: data_blob_pad checks its alignment assumption
authorDouglas Bagnall <douglas.bagnall@catalyst.net.nz>
Wed, 11 Dec 2024 01:31:18 +0000 (14:31 +1300)
committerAndreas Schneider <asn@cryptomilk.org>
Fri, 20 Dec 2024 07:59:51 +0000 (07:59 +0000)
BUG: https://bugzilla.samba.org/show_bug.cgi?id=15756

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andreas Schneider <asn@samba.org>
Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org>
Autobuild-Date(master): Fri Dec 20 07:59:51 UTC 2024 on atb-devel-224

lib/util/data_blob.c

index 470aa67cc61c67c89bc54b28115077c9595c3cbc..84e814f2ae86f405336b285e3c0374def465a713 100644 (file)
@@ -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;
        }